|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Database queries or arrays ?
Is it faster to put all data from databse to an array and make all changes using that array and at the end you update the database(i.e. you call only 2 times SQL when you retrieve data and when you put the new one on) ?
Or every time you want to make any changes you make them directly on the database (i.e. every time you call SQL) 10x for your time ! |
|
#2
|
|||
|
|||
|
Message Moved
Thread moved from 'Database Help' to 'Programming Theory' by CodeKadiya.
Reason: |
|
#3
|
||||
|
||||
|
RE: Database queries or arrays ?
It depends. (It always depends.)
It's almost always faster to use as few database calls as possible, but you're probably going to run into some problems trying to update multiple rows with different data. What data are you modifying? Is each row modified by a person or is it a process? (A person is slow, so the speed of your database calls is much less important.) Are you concerned about data changing in the database between when you read it and when you write it? |
|
#4
|
|||||
|
|||||
|
RE: RE: Database queries or arrays ?
Thanks for your post.
Quote:
It's about the administration of a small CMS, so the data is one table that contains all articles. Quote:
Each row is modified by the admin user. Quote:
I'll change database only when I'm writing. It'a question of performence. Is it beter when the admin user logs in the system to put all the data in the memory, or only when he wants to modify some data to retrieve this one from SQL ? Less SQL calls is better, using memory ,or put the minimum vars in memory and every time when the admin decides to edit some data retrieve it form SQL-much SQL calls. Thanks for your time ! |
|
#5
|
|||
|
|||
|
RE: Database queries or arrays ?
If I were to do this, I would call just the needed data out of the database. Since it is a content management system, my thought would be that it would take longer to process if you pulled all the articles out and then did your processing, rather than just pulling the selected ones you want out and then processing.
|
|
#6
|
||||
|
||||
|
RE: Database queries or arrays ?
I'd suggest querying as little data as possible in as few querys as possible - of course, don't do less than you need.
I wouldn't worry about taking up too much system memory unless the content you're talking about is on the order of megs of data. |
|
#7
|
|||
|
|||
|
RE: Database queries or arrays ?
Thanks all of you, I think you're right it's better to retrieve only the needed vars for reading, and if the admin wants to edit some content retrieve from db only that article!
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > Database queries or arrays ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|