Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Left Join on 2 Integers, 1 Float, or 1 Char

Left Join on 2 Integers, 1 Float, or 1 Char

From: Dan Fitzpatrick <dan_at_rapidascent.com>
Date: Mon, 14 May 2001 17:27:46 -0700
Message-ID: <3B007802.5F81C7A2@rapidascent.com>

I have 2 tables in Oracle 8i. One has 500,000 records (Table A), the other 5 million (Table B). I have to left join them on two integers. Which of the following will have the best performance (fastest select)? Or is there another option?

Option 1: Join on 2 integer fields

SELECT A.*, B.*
FROM A, B

WHERE  A.INTEGER1 = B.INTEGER1(+)
AND    A.INTEGER2 = B.INTEGER2(+)
AND    A.INTEGER1 = 1234
AND    A.INTEGER2 = 89


Option 2: Create a floating point field combining the two integers and join on it.

SELECT A.*, B.*
FROM A, B
WHERE A.FLOAT1 = B.FLOAT1(+)
AND A.FLOAT1 = 1234.89 Option 3: Create a char or varchar2 field combining the two integers and join on it.

SELECT A.*, B.*
FROM A, B
WHERE A.CHAR1 = B.CHAR1(+)
AND A.CHAR1 = '1234-89' Thanks,

Dan Received on Mon May 14 2001 - 19:27:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US