pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Clark <matt@ymogen.net>
To: 'Allen Landsidel' <alandsidel@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Strange (?) Index behavior?
Date: Fri, 5 Nov 2004 15:06:32 -0000
Message-ID: <007a01c4c349$092cdae0$8300a8c0@solent> (raw)
In-Reply-To: <88f1825a041105063955367088@mail.gmail.com>

> For some reason it's a requirement that partial wildcard 
> searches are done on this field, such as "SELECT ... WHERE 
> field LIKE 'A%'"
> 
> I thought an interesting way to do this would be to simply 
> create partial indexes for each letter on that field, and it 
> works when the query matches the WHERE clause in the index 
> exactly like above.  The problem is thus:

I thought PG could use an ordinary index for 'like' conditions with just a
terminating '%'?

My other thought is that like 'A%' should grab about 1/26th of the table
anyway (if the initial character distribution is random), and so a
sequential scan might be the best plan anyway...

M




view thread (27+ messages)  latest in thread

Message-ID: <007a01c4c349$092cdae0$8300a8c0@solent>
Permalink:  ../007a01c4c349$092cdae0$8300a8c0@solent/
Also on:    postgresql.org/message-id/007a01c4c349$092cdae0$8300a8c0@solent

 · 

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: matt@ymogen.net, alandsidel@gmail.com
  Subject: Re: Strange (?) Index behavior?
  In-Reply-To: <007a01c4c349$092cdae0$8300a8c0@solent>

* 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