1

I am setting up a site that has products and images of those products. Each image is stored as an entry in a table in the database. Each product can have any amount of images, but it is an average of fifteen images. With 1500 products (the prospected current amount) with an average of 15 images, I have already hit 22,500 entries in one table. When is a table considered 'full'? How many entries should I allow in my table before the user will notice slowdown?

EDIT: I should mention that I do store the images on the filesystem, the tables just store a path and filename with some other relevant data.

Abraham Brookes
  • 1,720
  • 1
  • 17
  • 32
  • http://stackoverflow.com/questions/2716232/maximum-number-of-records-in-a-mysql-database-table – sumskyi Sep 03 '12 at 14:05
  • 22,500 entries isn't all that much for a DBMS. They're supposed to be able to handle such things. – Waleed Khan Sep 03 '12 at 14:05
  • Yes, @arxanas is right, I would start worrying when you hit a couple of millions of rows. At that time, you still have options like vertical partitioning your tables. – Resh32 Sep 03 '12 at 14:10
  • If you want to ease your DB, please cache the images on disk as much as possible (store them in your filesystem the first time a user request them) – Resh32 Sep 03 '12 at 14:11

2 Answers2

2

Here are the limits on MySQL table size:

http://dev.mysql.com/doc/refman/5.0/en/table-size-limit.html

You should probably store your images outside the database if you can. This will scale much better.

Resh32
  • 6,500
  • 3
  • 32
  • 40
  • Funny, we both editted our answer on not storing images in the db at the same time ;) – Ben Fransen Sep 03 '12 at 14:07
  • Yes, it is a common recommendation. I actually did the opposite in the latest app I'm doing because the images are max 100px x 100 px and I cache them on disk as well. The advantage is that you have everything in one place (for backups) – Resh32 Sep 03 '12 at 14:09
0

Slow results are in many cases the result of poor or no indexation. To handle enough rows you should take something like an int 8 for your PK.

And, don't store your images in your database, but just to the file system of your server.

Ben Fransen
  • 10,884
  • 18
  • 76
  • 129