Re: intercepting where clause on a view or other performance tweak

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: intercepting where clause on a view or other performance tweak
Date: 2012-11-16 15:05:07
Message-ID: 14368.1353078307@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Russell Keane 2012-11-16 15:17:42 Re: intercepting where clause on a view or other performance tweak
Previous Message Russell Keane 2012-11-16 14:28:25 intercepting where clause on a view or other performance tweak