Op maandag 1 juli 2002 14:18, schreef andy:
Hi there,
I am wondering if anybody has experiance in saving images to blob in mysql.
I do save images with 1 K and 4 KB to blob fields while I used to save them
to file. It seams to me that this is much slower accessing the files. The
images take a bit (really short but absolutly noticable) to show up on the
site. Is there a way to improve the performance, and why is this happening?
I thought the performance might even boost after storing them to blobs.
Thank you for any comments on that,
Andy
From the faq on http://www.bitbybit.dk/mysqlfaq/comments.html#ch7_2_0
Storing images and other binary data
Many people ask how to store and retrieve images and other binary data in the
database. The question usually pops up along with a statement a la how do I
retrrieve and show an image on a web page?
There are several reasons why you should consider not storing binary data in
your database:
* The whole point of storing stuff in a SQL database, is to put some kind
of ordering and structure on your data, as well as being able to search on
these data. But how do you search in the binary data of your picture?
* For large data sets, storing binary data will quickly run up the size of
your database files, making it harder to control the size of the database.
* In order to store binary data in the database, you must continually
escape and unescape the data to ensure that nothing breaks.
You probably have several reasons why you would want to store your images in
your database, despite all the statements above. Others have, before you. And
they have all returned to the same solution: Store a link (e.g. a file path)
to the image file in the database. Whenever you need the image, use the link
in whatever program you use to retrieve the file containing the image.
Besides keeping your sanity, you will often find that things work faster this
way: You have less data to transfer between your application and MySQL, you
don't need to worry about escaping funny characters. And especially for
serving HTML pages, you're helping your server decide which data to keep
cached for faster client retrieval.
There is one good reason why you might want to store the binary data in the
database: Replication. If you need to ensure that the binary data is
available on several MySQL hosts, using replication might save your day. That
said, you should always keep the statements above in mind.
HTH
Ray
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php