pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Impact of varchar/text in use of indexes
2+ messages / 2 participants
[nested] [flat]

* Impact of varchar/text in use of indexes
@ 2004-03-11 18:25  Mike Moran <mike_moran@mac.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Mike Moran @ 2004-03-11 18:25 UTC (permalink / raw)
  To: pgsql-performance

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?

Ta,

-- 
Mike





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Impact of varchar/text in use of indexes
@ 2004-03-11 19:02  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Mike Moran <mike_moran@mac.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2004-03-11 19:02 UTC (permalink / raw)
  To: Mike Moran <mike_moran@mac.com>; +Cc: pgsql-performance

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-03-11 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-11 18:25 Impact of varchar/text in use of indexes Mike Moran <mike_moran@mac.com>
2004-03-11 19:02 ` Tom Lane <tgl@sss.pgh.pa.us>

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