On Thu, 24 Apr 2003, Jonathan Bartlett wrote:
> Okay, after upgrading Postgres to 7.3.2, I got some improvements to my
> query through factoring, but it was obvious my tables needed a little
> help. Therefore, I've modified my base tables and views, and now, even
> with enable_seqscan=off, it's not factoring through. Here is my query:
>
> select * from all_actions where campaign = 3;
>
> The full query plan is at the end of the email. Basically, all_actions is
> a view of several tables, each of which either have a field called
> "campaign" or "cached_campaign". It is indexed for all affected tables.
> However, for every table it does a sequential scan rather than an indexed
> scan. Any ideas on how to get it to at least attempt an indexed scan?
What does the actual view look like? It seems to be pushing campaign=3
into a scan of campaign_sent_mails (although it's using a different index
on that).