I have two tables here:
ITEMS
ID| DETAILS| .....| OWNER
USERS:
ID| NAME|....
Where ITEMS.OWNER = USERS.ID
I'm listing the items out with their respective owners names. For this I could use a join on both tables or I could select all the ITEMS and loop through them making a sql query to retrieve the tuple of that itmes owner. Thats like:
1 sql with a JOIN versus 1x20 single table sql queries
Which would be a better apporach to take in terms of speed? Thanks
Of course a JOIN will be faster.
Making 20 queries will imply:
20 times20 index seeks to find the start of the index range on items20 recordsets (each with its own metadata).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With