Re: Rewriting using rules for performance - Mailing list pgsql-performance

From Matthew Wakeling
Subject Re: Rewriting using rules for performance
Date
Msg-id alpine.DEB.2.00.0904031450190.21772@aragorn.flymine.org
Whole thread Raw
In response to Re: Rewriting using rules for performance  (Robert Haas <robertmhaas@gmail.com>)
List 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.

pgsql-performance by date:

Previous
From: Robert Haas
Date:
Subject: Re: plpgsql arrays
Next
From: Matthew Wakeling
Date:
Subject: Re: plpgsql arrays