Jump to content

Which is Faster: Reading Through Folders or Database


cmfans

Recommended Posts

I'm currently writing gallery software for the fun of it and I have a question about performance. Would it be faster to save a list of images in a database and read from the database, or dynamically read through each folder in the gallery server for every image that currently exists. Right now my gallery reads through each folder for each currently existing image on page load.

 

If I changed it to a database-based model I'd have to write some more code when images are uploaded but that wouldn't be too bad if it would be much faster. Also, would using a database cut down on server cpu usage? Any insight is appreciated.

 

Here is an example gallery based on my code: http://www.blowthecart.com/christinemendoza

Link to comment
Share on other sites

shes pretty hot, I'd hit it.. but with a database you'd be better off. You'd be able to fit way more information around the images with a database, and the database won't be looking through folders just fetching data, also paginating will be a tiny bit easier..

 

so faster + better information capacity..

 

What you'd want to do is keep the images whereever they are, and in the database point to those images.

Link to comment
Share on other sites

russell hit the hammer on the head.

 

Databases will work much faster than any code most of us could write. and for those who could write stuff that works faster than databases. its not worth their time. they are writing the code for space rockets and whatnot. If your really worried about performance though, check into caching.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.