I've got a youtube style site however it involves pictures.
Around the home page I wish to show latest pictures which have been submitted above typically the most popular pictures ever.
Could it be smart to perform a database/cache query for each user once they hit the page to be able to check exactly what the latest images are and display them or must i do that a different way to make sure the database is not constantly flooded with demands for that latest published pictures?
Maybe some kind of batch job?
Probably the most fundamental positive factor that you can do here's to cache the outcomes from the DB query - in both your application code (less more suitable) or perhaps in a current bit of infrastructure integrate-able inside your web "stack", for instance something similar to Memcached:
It has assisted many a DB-backed site achieve some minimal degree of scalability/performance.
Based on your DB, you may also cache such queries included in DB functionality itself, but it is better if you're able to intercept may be before they can arrive at the DB.