Re: Diferent execution plan for similar query

From: Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Diferent execution plan for similar query
Date: 2003-04-28 10:41:33
Message-ID: 200304281611.33669.shridhar_daithankar@nospam.persistent.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Monday 28 April 2003 15:56, jgimenez(at)sipec_quitaesto_(dot)es wrote:
> Somebody could explain me why this query...
>
> SELECT *
> FROM articulos,eans
> WHERE articulos.id_iinterno=eans.id_iinterno
> AND eans.id_iean=345
>
> is slower than this one? (the difference is the quotes around the
> number....)
>
> SELECT *
> FROM articulos,eans
> WHERE articulos.id_iinterno=eans.id_iinterno
> AND eans.id_iean='345'

In second case, postgresql typecasted it correctly. Even
eans.id_iean=345::int8 would have worked the same way. By default postgresql
treats a number as int4 while comparing and integer and float8 for a real
numbe. I discovered that yesterday.

Until the planner/parser gets smarter, this is going to be an FAQ..

Shridhar

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Naeslund(w) 2003-04-28 10:59:07 Re: Diferent execution plan for similar query
Previous Message jgimenez 2003-04-28 10:26:03 Diferent execution plan for similar query

Browse pgsql-performance by date

  From Date Subject
Next Message Magnus Naeslund(w) 2003-04-28 10:59:07 Re: Diferent execution plan for similar query
Previous Message jgimenez 2003-04-28 10:26:03 Diferent execution plan for similar query