tags:

views:

100

answers:

4

i have the video gallery in my database, which has over 200 000 videos. in my home page in the site i show exactly some videos, which must satisfy to some criteria. and so, what is the question. is it a good way to sort videos every time the home page opene, or i must save the sort results somewhere in the database, and refresh them only if something change. i think it can save me a lot of time. what you think about it. thanks in advance.

A: 

do any optimizations steps only when you have troubles with performance. until the troubles appeared - just hold breath and monitor performance statistics.

zerkms
+2  A: 

If the sort operation is expensive, do it at intervals or on specific triggers, otherwise do it dynamically

Colin Pickard
i don't worry about money!!! i just think how to make my site faster!!!
Syom
I suspect he's don't even know if this operation expensive or not. As he didn't even try. Also, if it get's expensive, database optimization is the first thing to do and denormalization - the last.
Col. Shrapnel
He means expensive in terms of CPU cycles, and therefore performance of your site.
ZombieSheep
hmmm, ok, i undertsand:) sorry:)
Syom
how can i verify is it expensive or not???
Syom
+1  A: 

Sort videos every time the page opened. Database were invented intentionally to do such things.

Col. Shrapnel
u are true, if my database isn't so big!!! now i lose expensive miliseconds, so i want to improove!!!
Syom
@Syom miliseconds never can be expensive. And there are many other ways to optimize your database. Do you use any **index** yet?
Col. Shrapnel
if millisecond delta is important for you - then you have to hire the professional developer.
zerkms
@Col. Shrapnel, i've done them allready! now i want to understand can i win any time ba such way!
Syom
+4  A: 

You should let the database sort the data!!! If the table is set up correctly it shouldn't be much overhead!!! You can also look into query caching which can do some of what you are thinking of doing for you!!! I was very excited to answer this question!!!

Ryan Elkins
thanks. i understand what you want to say;)
Syom