Hi I would actually do it like this…so that the set on the left of JOIN becomes smaller
SELECT a.item_id, a.create_dt FROM ( SELECT item_id, create_dt FROM A WHERE item_id = 'I001' AND category_name = 'C001' ) a JOIN b ON a.item_id = b.item_id ; From: Naga Vijay <nvti...@gmail.com<mailto:nvti...@gmail.com>> Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" <user@hive.apache.org<mailto:user@hive.apache.org>> Date: Wednesday, June 12, 2013 9:17 PM To: "user@hive.apache.org<mailto:user@hive.apache.org>" <user@hive.apache.org<mailto:user@hive.apache.org>> Subject: Enhancing Query Join to speed up Query Hi, Which of the two query options is better? SELECT a.item_id, a.create_dt FROM a JOIN b ON (a.item_id = b.item_id) WHERE a.item_id = 'I001' AND a.category_name = 'C001'; - or - SELECT a.item_id, a.create_dt FROM a JOIN b ON (a.item_id = b.item_id AND a.item_id = 'I001') WHERE a.category_name = 'C001'; Thanks Naga CONFIDENTIALITY NOTICE ====================== This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.