Re: Optimizer's issue - Mailing list pgsql-performance

From Matthew Wakeling
Subject Re: Optimizer's issue
Date
Msg-id Pine.LNX.4.64.0804241140170.13221@aragorn.flymine.org
Whole thread Raw
In response to Re: Optimizer's issue  (Vlad Arkhipov <arhipov@dc.baikal.ru>)
List pgsql-performance
On Thu, 24 Apr 2008, Vlad Arkhipov wrote:
> It was written below in my first post:
> "These queries are part of big query and optimizer put them on the leaf
> of query tree, so rows miscount causes a real problem. "
> actual rows count for the first query is 294, estimate - 11; for the
> second -- 283 and 0. Postgres tries to use nested loops when it should
> use merge/hash join and vice versa.

The queries are taking less than three milliseconds. You only have three
hundred rows in each table. The precise algorithm Postgres uses probably
won't make much of a difference. Have you tried turning off the relevant
join plans to see how long Postgres takes with your desired plan?

When you have millions of rows, the algorithm matters a lot more.

Matthew

--
Richards' Laws of Data Security:
 1. Don't buy a computer.
 2. If you must buy a computer, don't turn it on.

pgsql-performance by date:

Previous
From: Vlad Arkhipov
Date:
Subject: Re: Optimizer's issue
Next
From: Gregory Stark
Date:
Subject: Re: off-topic: SPAM