pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shridhar Daithankar <shridhar_daithankar@myrealbox.com>
To: Laurent Martelli <laurent@aopsys.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Join on incompatible types
Date: Wed, 19 Nov 2003 12:24:04 +0530
Message-ID: <3FBB138C.4090303@myrealbox.com> (raw)
In-Reply-To: <87oev9lsgs.fsf@news.nerim.net>
References: <Pine.LNX.4.33.0310291446430.22074-100000@css120.ihs.com>
	<87k75ym1v7.fsf@news.nerim.net>
	<3FB9F855.7010905@myrealbox.com>
	<87oev9lsgs.fsf@news.nerim.net>

Laurent Martelli wrote:

>>>>>>"Shridhar" == Shridhar Daithankar <shridhar_daithankar@myrealbox.com> writes:
> 
> 
>   Shridhar> Laurent Martelli wrote:
> 
> [...]
> 
>   >> Should I understand that a join on incompatible types (such as
>   >> integer and varchar) may lead to bad performances ?
> 
>   Shridhar> Conversely, you should enforce strict type compatibility
>   Shridhar> in comparisons for getting any good plans..:-)
> 
> Ha ha, now I understand why a query of mine was so sluggish.
> 
> Is there a chance I could achieve the good perfs without having he
> same types ? I've tried a CAST in the query, but it's even a little
> worse than without it. However, using a view to cast integers into
> varchar gives acceptable results (see at the end).
> 
> I'm using Postgresql 7.3.4.

I am stripping the analyze outputs and directly jumping to the end.

Can you try following?

1. Make all fields integer in all the table.
2. Try following query
EXPLAIN ANALYZE SELECT * from lists join classes on classes.id=lists.value where 
lists.id='16'::integer;

How does it affect the runtime?

  Shridhar




view thread (8+ messages)  latest in thread

Message-ID: <3FBB138C.4090303@myrealbox.com>
Permalink:  ../3FBB138C.4090303@myrealbox.com/
Also on:    postgresql.org/message-id/3FBB138C.4090303@myrealbox.com

 · 

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-performance@postgresql.org
  Cc: shridhar_daithankar@myrealbox.com, laurent@aopsys.com
  Subject: Re: Join on incompatible types
  In-Reply-To: <3FBB138C.4090303@myrealbox.com>

* 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