Re: Index use difference betweer LIKE, LIKE ANY?

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Sam Wong <sam(at)hellosam(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Index use difference betweer LIKE, LIKE ANY?
Date: 2011-06-06 09:47:10
Message-ID: 4DECA21E.2090307@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 06.06.2011 12:43, Heikki Linnakangas wrote:
> Also, even when safe, it's not clear that the transformation is always a
> win. The left-hand expression could be expensive, in which case having
> to evaluate it multiple times could hurt performance. Maybe yo

Sorry, hit "send" too early.

Maybe you could put in some heuristic to only do the transformation when
the left-hand expression is cheap, or maybe use something like the
CaseTestExpr to avoid multiple evaluation and still use the OR form.
Also, if the array is very large, opening it into the OR form could
increase plan time substantially, so we'd probably only want to do it if
there's any Vars involved, and thus any chance of matching an index.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2011-06-06 15:48:49 Re: Different execution time for same plan
Previous Message Heikki Linnakangas 2011-06-06 09:43:55 Re: Index use difference betweer LIKE, LIKE ANY?