Re: Images : Store in dB or disk?
| From: | Marek Kilimajer | Date: | Thu, 16 Jan 2003 10:59:01 +0000 |
| Subject: | Re: Images : Store in dB or disk? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131841@lists.php.net to get a copy of this message | ||
Bobby Patel wrote:
Hello, I have the Images table setup with columns (width, height, size, type, etc...) the question is should I have the image data stored in this table or disk? I know, alot of people have said it is faster in disk, which is 1 page I/O. But I need these images for displaying product pages, and I believe that it would be faster to just pluck the properties from the dB (including the image file) . Usually I will need to pull 6 or 10 images per page, this is my rational for this situation: If all stored on db: One query - will take about 4-5 page I/O (assumiing index on filename) images will be requested separate, so there will be query to get the properties (page request), and queries to get the actual image data (requests for images).
If just properties stored on dB and image on disk: One query to grab the rows of properties - 2-3 page I/O to grab 6 or 10 images - 6 or 10 page I/O Total - 8 - 13 Page I/O's If all images stored on disk, no dB whatso ever: to grab 6 or 10 images - 6 or 10 page I/O cpu time to run getimagesize() for each image - CPU time unknown? I assume that "page I/O" is that same as "disk access". I AGREE that storing images strored on disk is a valid approach PROVIDED that you only need 1 image per page, but if you need to grab a bunch at a time, I do beleieve that storing the actual file on the dB is faster. I would like to hear from the list, of people that have worked with images and PHP. I just started with images, so I just want to take the right path.