Re: Rewriting using rules for performance

From: Matthew Wakeling <matthew(at)flymine(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Rewriting using rules for performance
Date: 2009-04-03 13:55:15
Message-ID: alpine.DEB.2.00.0904031450190.21772@aragorn.flymine.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, 3 Apr 2009, Robert Haas wrote:
> On the other hand, the query planner should be figuring out which
> index to use without any help from you. If it's not, something is
> wrong.

Unfortunately it cannot tell that

SELECT l1.id AS id1, l2.id AS id2 FROM location l1, location l2
WHERE l1.start <= l2.end AND l2.start <= l1.end

is the same as

SELECT l1.id AS id1, l2.id AS id2 FROM location l1, location l2
WHERE bioseg_create(l1.start, l1.end) && bioseg_create(l2.start, l2.end)

which is also the same as

SELECT * from do_overlaps() AS (id1 int, id2 int)

But thanks for clarifying the rule thing for me.

Matthew

--
The email of the species is more deadly than the mail.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew Wakeling 2009-04-03 13:57:12 Re: plpgsql arrays
Previous Message Robert Haas 2009-04-03 13:47:31 Re: plpgsql arrays