-4

The total number of queries is: Q1 * Q2 * Q3, it might be 25 * 3 * 4 = 300, or maybe even more.

all of these is for a single user displaying a single page!

Should I duplicate the data and store them directly in the first queried table, this would reduce the number of queries dramatically from 300+ to a single query.

Or should I leave the database normalized with no duplications?


for example:

SELECT * FROM items
  JOIN descriptions on descriptions.id = items.description_id
  JOIN properties on properties.id = descriptions.property_id
  JOIN images on images.id = properties.image_id;

so I assumed the first table has 25 items, for each item there is 3 items and so on .. the number of joins should be a lot

1

1 Answer 1

1

If the page is designed to display 300 pieces of data then the application must read 300 pieces of data from the database. End of discussion.

What you show is not 300 queries. It is one query returning 300 rows. This is exactly what a DBMS is designed to do. This is not a big result set. From the given information this is unlikely to be a problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.