Re: String versus integer joins?

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Veronika Megler <vmegler(at)cecs(dot)pdx(dot)edu>
Cc: pdxpug(at)postgresql(dot)org
Subject: Re: String versus integer joins?
Date: 2012-10-23 17:39:43
Message-ID: 5086D65F.7060108@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug


On 10/23/2012 09:40 AM, Veronika Megler wrote:
>
> Hello all,
>
> I've heard persistent rumors that joining two table based on an integer
> id "must be" or "is" faster than joining on a string id.
>
> While I'd believe the "must be", does anyone have any pointers to (or
> evidence of) how much faster?
>
> I.e.; if the difference is 10 times, then it's worth us
> rewriting/testing/upgrading an application. If it's 10%, then it's not.

This actually can be false. It depends on what you are doing. Have a
natural key is faster for foreign key type checks because it actually
avoids the join you would need if you were using a number based key.

JD

--
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Support, Training, Professional Services and Development
High Availability, Oracle Conversion, Postgres-XC
@cmdpromptinc - 509-416-6579

In response to

Browse pdxpug by date

  From Date Subject
Next Message Mark Wong 2012-10-23 19:12:34 Re: String versus integer joins?
Previous Message Veronika Megler 2012-10-23 16:40:12 String versus integer joins?