Re: Inefficient filter order in query plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tom Coogan <nocera(at)gmail(dot)com>
Cc: sfrost(at)snowman(dot)net, pgsql-performance(at)postgresql(dot)org
Subject: Re: Inefficient filter order in query plan
Date: 2014-02-27 20:47:30
Message-ID: 15431.1393534050@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tom Coogan <nocera(at)gmail(dot)com> writes:
> Thanks Tom but why would strict equality checking (e.g. model =
> 'User') have the same cost as LIKE operations which (may) have to do
> pattern matching?

A bit of consultation of pg_proc.procost will show you that just about
the only internal functions with costs different from 1X cpu_operator_cost
are those that do some sort of database access (and, in consequence, have
true costs a couple orders of magnitude higher than a simple comparison).
We may eventually get around to refining the cost model so that it can
tell the difference between = and LIKE, but nobody's yet done the work
to decide which functions ought to get assigned what costs. I'm
disinclined to single out LIKE for special treatment in the absence of
some sort of framework for deciding which functions are worth penalizing.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Coogan 2014-02-28 18:29:29 Re: Inefficient filter order in query plan
Previous Message Tom Coogan 2014-02-27 20:34:04 Re: Inefficient filter order in query plan