Re: Index Ignored Due To Use Of View

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index Ignored Due To Use Of View
Date: 2011-02-25 14:28:59
Message-ID: 012401cbd4f8$587ee440$097cacc0$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I cannot get the problem to appear using generated data and cannot provide
the real database.

Given these facts, and the fact I can use the "expanded" query to get the
necessary results, I am going to move on.

If you want me to provide any additional information with respect to this
behavior using my live data just let me know and I'll try and do what I can.

BTW, for the test case I used all the same tables that are referenced in the
two views but with many of the non-key attributes removed. I then loaded
10,000+ records into the relevant tables and ran the explains.

David J.

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
Sent: Friday, February 25, 2011 12:33 AM
To: David Johnston
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Index Ignored Due To Use Of View

"David Johnston" <polobo(at)yahoo(dot)com> writes:
> Now, if I simply replace the original FROM clause with the view
> definition (i.e., SELECT * FROM (SELECT ... ) alias WHERE ) I get:
> [ a different plan ]
> I now have index scans on both "filetaskinstance" and "filereference"
> - but all I appeared to do is the same as what rule re-writing should have
done.

If you really just manually plugged in the view definition, then yeah you
should have gotten the same results. Could we see a complete test case?

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message akp geek 2011-02-25 14:30:28 select to_timestamp('02/26/2011 14:50', 'MM/DD/YYYY HH24MI')
Previous Message Vick Khera 2011-02-25 13:26:56 Re: pg_dump makes our system unusable - any way to pg_dump in the middle of the day? (postgres 8.4.4)