pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: David B <postgresql@thegatelys.com>
To: pgsql-sql@postgresql.org
Subject: Re: Faster performance when using where cust_id = '123' vs cust_id = 123. Does 7.4 fix this??
Date: Tue, 9 Dec 2003 22:45:46 +0100
Message-ID: <200312092245.46122.peter_e@gmx.net> (raw)
In-Reply-To: <GOEGKICPFOPNLIEIHGFJGEJMCEAA.postgresql@thegatelys.com>
References: <GOEGKICPFOPNLIEIHGFJGEJMCEAA.postgresql@thegatelys.com>

David B wrote:
> We have got used to the problem that queries of the format:
>
> select *
> from customer
> where cust_id = '123' are much much faster than
>
> select *
> from customer
> where cust_id = 123
>
> (where cust_id is defined as bigint).
>
> a. Why is this.

Because in the second case, the 123 gets resolved too early to type 
integer, which is not index compatible with type bigint.

> b. Will moving to v7.4 change this so we can avoid the whole '123'
> casting thing.

No, but 7.5 will be able to handle it.




view thread (2+ messages)

Message-ID: <200312092245.46122.peter_e@gmx.net>
Permalink:  ../200312092245.46122.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200312092245.46122.peter_e@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, postgresql@thegatelys.com
  Subject: Re: Faster performance when using where cust_id = '123' vs cust_id = 123. Does 7.4 fix this??
  In-Reply-To: <200312092245.46122.peter_e@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox