Re: Best join columns

From: James Forgy <forgy_at_ll.mit.edu>
Date: Fri, 15 Apr 94 13:06:36 -0400
Message-ID: <9404151306.PN21241_at_LL.MIT.EDU>


In article <jdennisCoAw98.H6_at_netcom.com> jdennis_at_netcom.com (John Dennis) writes:
>From: jdennis_at_netcom.com (John Dennis)
>Subject: Best join columns
>Date: Fri, 15 Apr 1994 12:34:20 GMT

>I'm considering the problems with changing all the CHARs in a
>database to VARCHAR2. I thought that that one would certainly
>be faster than the other during a join. I assume that the order
>of faster-to-slowest joining two columns as:
 

>DATE
>INT
>FLOAT
>[ VARCHAR | CHAR (?) ]
 
>Anybody have knowledge of this kind of infomation?
 

>John Dennis

The difference is negligible. The speed of a join column does have some basis in the byte length of the column:

Date - 7 byes
Int (less than 7)
float - You pick
varchar - you pick

A very large indexed column in a join will of course create a bigger index to scan. If you have luxury of chosing a join column type, which in itself might point to a poor design, then chose the smallest column.

The key to joins in the use of indexes and that the "driving table" (non indexed) is the smallest table.

-jf Received on Fri Apr 15 1994 - 19:06:36 CEST

Original text of this message