From: Tom Lane <tgl@sss.pgh.pa.us>
To: Frank van Vugt <ftm.van.vugt@foxi.nl>
Cc: pgsql-performance@postgresql.org
Subject: Re: plan difference between set-returning function with ROWS within IN() and a plain join
Date: Tue, 06 May 2008 10:17:10 -0400
Message-ID: <13551.1210083430@sss.pgh.pa.us> (raw)
In-Reply-To: <200805061021.43448.ftm.van.vugt@foxi.nl>
References: <200805061021.43448.ftm.van.vugt@foxi.nl>
Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
> db=# explain analyse
> select sum(base_total_val)
> from sales_invoice
> where id in (select id from si_credit_tree(80500007));
Did you check whether this query even gives the right answer? The
EXPLAIN output shows that 21703 rows of sales_invoice are being
selected, which is a whole lot different than the other behavior.
I think you forgot the alias foo(id) in the subselect and it's
actually reducing to "where id in (id)", ie, TRUE.
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, ftm.van.vugt@foxi.nl
Subject: Re: plan difference between set-returning function with ROWS within IN() and a plain join
In-Reply-To: <13551.1210083430@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