Re: [PERFORM] Rewriting using rules for performance

2009-04-03 Thread Matthew Wakeling
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 =

Re: [PERFORM] Rewriting using rules for performance

2009-04-03 Thread Merlin Moncure
On Fri, Apr 3, 2009 at 9:17 AM, Matthew Wakeling matt...@flymine.org wrote: So, I have a view. The query that the view uses can be written two different ways, to use two different indexes. Then I use the view in another query, under some circumstances the first way will be quick, and under

Re: [PERFORM] Rewriting using rules for performance

2009-04-03 Thread Merlin Moncure
On Fri, Apr 3, 2009 at 11:52 AM, Merlin Moncure mmonc...@gmail.com wrote: On Fri, Apr 3, 2009 at 9:17 AM, Matthew Wakeling matt...@flymine.org wrote: So, I have a view. The query that the view uses can be written two different ways, to use two different indexes. Then I use the view in another