Skip site navigation (1) Skip section navigation (2)

Re: Join on incompatible types

From: Laurent Martelli <laurent(at)aopsys(dot)com>
To: Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Join on incompatible types
Date: 2003-11-19 09:52:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
>>>>> "Shridhar" == Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com> writes:

  Shridhar> Laurent Martelli wrote:
  >>>>>>> "Shridhar" == Shridhar Daithankar
  >>>>>>> <shridhar_daithankar(at)myrealbox(dot)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.

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

  Shridhar> Can you try following?

  Shridhar> 1. Make all fields integer in all the table.  

I can't do this because lists.values contains non integer data which
do not refer to a value. It may sound weird. This is
because it's a generic schema for a transparent persistence framework.

The solution for me would rather be to have varchar everywhere.

  Shridhar> 2. Try following query EXPLAIN ANALYZE SELECT * from lists
  Shridhar> join classes on where

  Shridhar> How does it affect the runtime?

  Shridhar>   Shridhar

Laurent Martelli
laurent(at)aopsys(dot)com                                Java Aspect Components                   

In response to


pgsql-performance by date

Next:From: Shridhar DaithankarDate: 2003-11-19 10:19:23
Subject: Re: Join on incompatible types
Previous:From: Ian BarwickDate: 2003-11-19 09:18:18
Subject: TEXT column and indexing

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group