pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mike Moran <mike_moran@mac.com>
Cc: PgSQL Performance ML <pgsql-performance@postgresql.org>
Subject: Re: Impact of varchar/text in use of indexes
Date: Thu, 11 Mar 2004 14:02:11 -0500
Message-ID: <21844.1079031731@sss.pgh.pa.us> (raw)
In-Reply-To: <4050AF10.9060006@mac.com>
References: <4050AF10.9060006@mac.com>

Mike Moran <mike_moran@mac.com> writes:
> Hi. I have two existing tables, A and B. A has a 'varchar(1000)' field 
> and B has a 'text' field, each with btree indexes defined. When I do a 
> join between these, on this field, it seems to a hash join, as opposed 
> to using the indexes, as I might expect (I'm no postgres expert, btw).

> My question is: if I changed both fields to be text or varchar(1000) 
> then would the index be used?

Probably not, and in any case your assumption is mistaken.  Indexes are
not always the right way to join.

			regards, tom lane



view thread (2+ messages)

Message-ID: <21844.1079031731@sss.pgh.pa.us>
Permalink:  ../21844.1079031731@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21844.1079031731@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, mike_moran@mac.com
  Subject: Re: Impact of varchar/text in use of indexes
  In-Reply-To: <21844.1079031731@sss.pgh.pa.us>

* 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