Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

Will the Where condition be better than the JOIN table condition?

Dear experts,

I've question with mysql query.  I want to process an online order which users will input the item number and the quantity that they wish to buy.

Will it be better that I store the item number and quantity into a temporary table and do a JOIN with the item number (item numbers are unique number) in my item table or I can select the columns that I need from item table and place all the item numbers provided by users in the where condition of a query?

User's input can be ranged from a single row to few thousand rows(maybe 10K on rare occasions).

Thanks
0
Kinderly Wade
Asked:
Kinderly Wade
1 Solution
 
nemws1Database AdministratorCommented:
Well, for small sets I'd do an inline WHERE, but for large sets, I'd do the temp table.  The safe bet is the temp table.  If you have a *really* huge set of numbers, you might run into the 'max_packet_size' for MySQL when trying to do a WHERE and then it won't work at all (although this would be pretty dang rare and they'd have to have a ton of rows selected).
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now