Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 2061 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Database calls or data storage more expensive?

Thread title: Database calls or data storage more expensive?
Closed Thread    
    Thread tools Search this thread Display Modes  
12-21-2007, 11:22 PM
#1
George the Flea is offline George the Flea
Status: Junior Member
Join date: Dec 2007
Location: Seattle, WA
Expertise:
Software:
 
Posts: 52
iTrader: 0 / 0%
 

George the Flea is on a distinguished road

  Old  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
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

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
George the Flea is offline George the Flea
Status: Junior Member
Join date: Dec 2007
Location: Seattle, WA
Expertise:
Software:
 
Posts: 52
iTrader: 0 / 0%
 

George the Flea is on a distinguished road

  Old

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
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Specific calls are probably better unless their uses blatantly overlap.

12-22-2007, 01:50 AM
#5
George the Flea is offline George the Flea
Status: Junior Member
Join date: Dec 2007
Location: Seattle, WA
Expertise:
Software:
 
Posts: 52
iTrader: 0 / 0%
 

George the Flea is on a distinguished road

  Old

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.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed