mysql - PHP "Simple" query takes massive time -


I have a question about performance, I think I am doing something wrong.

I have a table with items, and one with categories, any item can be in multiple categories. Now I want to show all those things which have not been included in any category.

The connection table contains Items_Categories (just with ID_item and ID_category )

I Created query:

  as item ID_ item as id (items_Categories from item ID_item) Select  

this works , But it is very slow it takes a few seconds, and my DB is not so big. I have around 3000 items and 200 categories.

Any better solution?

You probably can use a join and find people who have a match is not.

  SELECT i. * Items are added to item items i.id_item = ic.ID_Item on I .ID_Item IS is null  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -