I have several fields in which I will be strong text. Various categories,
and for each category, its related subcategories. Each subcategory then
contains various items.
My question is, for performance, would it be better to assign each
category/subcategory pair a unique ID number and then anytime I need to
lookup something in a subcategory, look up the ID number and search off of
Or, would it be about the same to just search the entire list of items on
the text of the category subcategory?
Categories - Category (text), Subcategory (text), CatID (unique integer)
Items - CatID (integer relating to id in categories table), .... Other item
I would do something like:
SELECT CatID FROM Categories WHERE Category="desired category" AND
Then for example to retrieve all items in that subcategory:
SELECT * FROM Items WHERE CatID=(the id found in previous select)
Items - Category (text), Subcategory (text), ... Other item info
And to find all items in a subcategory, do:
SELECT * FROM Items WHERE Category="desired category" AND
It seems to me the second way would be slower, because it has to do many
more string tests. But does it make a difference? Is testing integer
equality actually faster than string equality?
|• Design Suggestion||Adam Clauss||21 Sep|