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

2012-11-16 Thread Tom Lane
Russell Keane writes: > Sorry, I should've added that in the original description. > I have an index on search_key and it's never used. Did you pay attention to the point about the nondefault operator class? If the LIKE pattern is left-anchored and as selective as your example implies, the planne

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

2012-11-16 Thread Russell Keane
al Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: 16 November 2012 15:05 To: Russell Keane Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] intercepting where clause on a view or other performance tweak Russell Keane writes: > Running the following query takes 56+ ms a

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

2012-11-16 Thread Russell Keane
6 November 2012 15:05 To: Russell Keane Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] intercepting where clause on a view or other performance tweak Russell Keane writes: > Running the following query takes 56+ ms as it does a seq scan of the whole > table: > SELECT CODE FR

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

2012-11-16 Thread Tom Lane
Russell Keane 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 'AA%' 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