|
|
|
|
Thread title: Database calls or data storage more expensive? |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
12-21-2007, 11:22 PM
|
#1
|
Status: Junior Member
Join date: Dec 2007
Location: Seattle, WA
Expertise:
Software:
Posts: 52
|
Database calls or data storage more expensive?
I have a conundrum: my site is driven by PHP and mySQL and I'm trying to optimize it to use the smallest amount of resources (server-side) possible. I am managing the site's navigational layout using a single database table. It doesn't matter, but I'm using CodeIgniter.
I'm trying to balance database calls with storing data in PHP; that is, do I do lots of very specific mySQL calls or more general calls and store the info (potentially including info I will not need for this page load) in PHP variables?
I'm not sure what the variable costs are for database queries and PHP data storage (per page load). Does anyone have some good resources I could look at?
In all odds either direction will work for this project without a problem (it's a very small site), but I'd like to optimize the code for use and growth in other projects.
Thanks for your help!
|
|
12-21-2007, 11:45 PM
|
#2
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
If its small and doesnt change, don't use a database. Otherwise a database is your best option.
|
|
12-22-2007, 12:08 AM
|
#3
|
Status: Junior Member
Join date: Dec 2007
Location: Seattle, WA
Expertise:
Software:
Posts: 52
|
The question is not whether or not to use a database; it's a dynamic site, so database use is mandatory.
The question is whether to make lots of little, very targeted mySQL calls, or a few large generic mySQL calls and find the subset of data that I need for a given page within PHP. I don't have any formal training in database construction, so if you know of any resources online that I could look at about relative expense of database calls, I'd really love to hear.
|
|
12-22-2007, 12:09 AM
|
#4
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
Specific calls are probably better unless their uses blatantly overlap.
|
|
12-22-2007, 01:50 AM
|
#5
|
Status: Junior Member
Join date: Dec 2007
Location: Seattle, WA
Expertise:
Software:
Posts: 52
|
Hmm, thanks. I'll be tossing any data that may be reused in the page into a class variable, so I shouldn't have any repeat calls, at least.
I really need to find some books on database design or something, I think.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|