Re: Overriding the optimizer

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Overriding the optimizer
Date: 2005-12-16 02:34:38
Message-ID: 43A227BE.9030106@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> Boy, you picked a *really* bad example ;-)
>
> The problem is that Postgres decided to filter on myfunc() *first*, and
> then filter on row_num, resulting in a query time that jumped from
> seconds to hours. And there's no way for me to tell Postgres not to do
> that!

Can you paste explain analyze and your effective_cache_size, etc. settings.

> So, "you still have no problem" is exactly wrong, because Postgres
> picked the wrong plan. Postgres decided that applying myfunc() to
> 10,000,000 rows was a better plan than an index scan of 50,000
> row_nums. So I'm screwed.

This seems like a case where PostgreSQL's current optimiser should
easily know what to do if your config settings are correct and you've
been running ANALYZE, so I'd like to see your settings and the explain
analyze plan...

Chris

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Craig A. James 2005-12-16 02:44:03 Re: Overriding the optimizer
Previous Message Mark Kirkwood 2005-12-16 02:31:03 Re: Overriding the optimizer