Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Which is faster?
Hi Gurus !
I'm going to some tables with huge amount of records. There are references between
these tables. The
question is:
Does it worth creating a procedure with several small selects or is it faster to use
one select with
joins?
For example:
CUSTOMER(CUST_ID);
CONTRACT(CONTR_ID,CUST_ID);
CONTRACT_ITEM(CONTR_I_ID,CONTR_ID,PHONE_NUM_ID);
PHONE_NUMBER(PHONE_NUM_ID,PHONE_NUM);
I have the PHONE_NUM and I need the CUST_ID.
Which Faster?
SELECT CUST_ID from PHONE_NUM,CONTRACT_ITEM,CONTRACT,CUSTOMER where .... [JOINS] and
PHONE_NUM=searchedone
or In procedure or function
select phone_num_id into Variable from phone where phone_num=searchedone; select contract_id into Variable2 from contract_item where phone_num_id=Variable; select cust_id into Variable from contract where contr_id=Variable2;
Thanks in advance.
Gyula
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Andor Gyula
INET: gy.andor_at_euromacc.hu
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Feb 20 2001 - 04:33:15 CST