SQL performance when dividing results into categories

Asked

Viewed 40 times

-1

I have a bank with all the products of my store, I want to list the products by categories but I do not know what is the most efficient way to do this, because it is a big bank. It would be better if I fetched all the products at once and with foreach and if make the groupings of items? Or make more than one query and in each search use WHERE categoria = 'MinhaCategora'?

Or would you have some other option to do that grouping?

1 answer

0

Perform filter by category reduces to the maximum your result otherwise you will return millions of records and you will not be able to put in memory, additionally check if you have index in this column of the table "tables" to optimize your query.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.