pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Russell Keane <Russell.Keane@inps.co.uk>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: intercepting where clause on a view or other performance tweak
Date: Fri, 16 Nov 2012 10:05:07 -0500
Message-ID: <14368.1353078307@sss.pgh.pa.us> (raw)
In-Reply-To: <8D0E5D045E36124A8F1DDDB463D548557D0CDC68A8@mxsvr1.is.inps.co.uk>
References: <8D0E5D045E36124A8F1DDDB463D548557D0CDC68A8@mxsvr1.is.inps.co.uk>

Russell Keane <Russell.Keane@inps.co.uk> writes:
> Running the following query takes 56+ ms as it does a seq scan of the whole table:
> SELECT CODE FROM stuff
>    WHERE SEARCH_KEY LIKE 'AAAAAA%'

Why don't you create an index on search_key, and forget all these other
machinations?  (If your locale isn't C you'll need to use a
varchar_pattern_ops index.)

			regards, tom lane




view thread (5+ messages)  latest in thread

Message-ID: <14368.1353078307@sss.pgh.pa.us>
Permalink:  ../14368.1353078307@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14368.1353078307@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, Russell.Keane@inps.co.uk
  Subject: Re: intercepting where clause on a view or other performance tweak
  In-Reply-To: <14368.1353078307@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