From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim C. Nasby <decibel@decibel.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Odd number of rows expected
Date: Sun, 23 Jan 2005 17:39:12 -0500
Message-ID: <7191.1106519952@sss.pgh.pa.us> (raw)
In-Reply-To: <20050123222942.GE67721@decibel.org>
References: <20050121203827.GW67721@decibel.org>
<26465.1106450280@sss.pgh.pa.us>
<20050123222942.GE67721@decibel.org>
"Jim C. Nasby" <decibel@decibel.org> writes:
> In english, each bucket defines a specific time period, and no two
> buckets can over-lap (though there's no constraints defined to actually
> prevent that). So reality is that each row in page_log.log will in fact
> only match one row in bucket (at least for each value of rrs_id).
> Given that, would the optimizer make a better choice if it knew that
> (since it means a much smaller result set).
Given that the join condition is not an equality, there's no hope of
using hash or merge join; so the join itself is about as good as you're
gonna get. With a more accurate rows estimate for the join result, it
might have decided to use HashAggregate instead of Sort/GroupAggregate,
but AFAICS that would not have made a huge difference ... at best maybe
25% of the total query time.
> Is there any way to tell the
> optimizer this is the case?
Nope. This gets back to the old problem of not having any cross-column
(cross-table in this case) statistics.
regards, tom lane
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: tgl@sss.pgh.pa.us, decibel@decibel.org
Subject: Re: Odd number of rows expected
In-Reply-To: <7191.1106519952@sss.pgh.pa.us>
* 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