pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Віталій Тимчишин <tivv00@gmail.com>
To: David Wilson <david.t.wilson@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: PostgreSQL OR performance
Date: Sat, 15 Nov 2008 15:55:38 +0200
Message-ID: <331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com> (raw)
In-Reply-To: <e7f9235d0811070207ka8baab0w5ffe6cfbb947b56b@mail.gmail.com>
References: <331e40660811050312u552cab53ifa88e493e1c4f7ac@mail.gmail.com>
	<1225902700.1432.53.camel@jdavis>
	<331e40660811060246m51df553egd4e2ba91f08d1434@mail.gmail.com>
	<29e3942f0811060426k5fe34b1av401a2dba62e4ae3c@mail.gmail.com>
	<331e40660811060833l49bf837em41ca88d4b2061ea1@mail.gmail.com>
	<49131ED5.80307@archonet.com>
	<331e40660811060937q460e6f9fvf336455200d31f56@mail.gmail.com>
	<331e40660811070114rd70cf0dy194020a9f9ea8802@mail.gmail.com>
	<e7f9235d0811070207ka8baab0w5ffe6cfbb947b56b@mail.gmail.com>

Sorry, for delayed response - It was very busy week.

2008/11/7 David Wilson <david.t.wilson@gmail.com>

> On Fri, Nov 7, 2008 at 4:14 AM, Віталій Тимчишин <tivv00@gmail.com> wrote:
> > "Merge Join  (cost=518771.07..62884559.80 rows=1386158171 width=32)
> (actual
> > time=30292.802..755751.242 rows=34749 loops=1)"
>
> Have you tried increasing the default_statistics_target? The planner
> is expecting 1.3 billion rows to be produced from a query that's only
> actually producting 35k, which probably indicates some very bad
> statistics.


 The planner seems to think that every second pair from company<->company
join will succeed with this join expression (1386158171 ~  52648^2 / 2).
That is not true.
Anyway, I've tried to set default_statistics_target to 1000, then analyze.
Nothing've changed

At the same time, the materialize step produces 242
> million rows when the planner only expects to produce 2.3, indicating
> a similar problem in the opposite direction. This probably means that
> the planner is choosing plans that would be optimal if it was making
> good guesses but are decidedly sub-optimal for your actual data.
>
>
That is even more strange, because materialize step must produce exactly the
rows it takes from sort, that is 2316503, so I don't get how table scan +
sort + materialize can multiply number of rows by 100.


view thread (16+ messages)  latest in thread

Message-ID: <331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com>
Permalink:  ../331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com/
Also on:    postgresql.org/message-id/331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tivv00@gmail.com, david.t.wilson@gmail.com
  Subject: Re: PostgreSQL OR performance
  In-Reply-To: <331e40660811150555l662be646ud07bf357348f1310@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox