From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michal Taborsky <michal.taborsky@mall.cz>
Cc: pgsql-performance@postgresql.org
Subject: Re: Searching union views not using indices
Date: Fri, 04 Nov 2005 12:53:07 -0500
Message-ID: <15833.1131126787@sss.pgh.pa.us> (raw)
In-Reply-To: <436B848F.5030402@mall.cz>
References: <436B4836.7030300@mall.cz>
<13815.1131118294@sss.pgh.pa.us>
<436B848F.5030402@mall.cz>
Michal Taborsky <michal.taborsky@mall.cz> writes:
> OK. Mystery (sort of) solved. After you told me it works for you I had
> to assume the problem was somewhere else. And, indeed, it was, though
> it's not too obvious.
> The two attributes are actually not of tybe bigint, but of type
> "crm_object_id", which is created as follows:
> CREATE DOMAIN "public"."crm_object_id" AS
> bigint NULL;
Ah. The problem is that the UNION's output column is bigint, and the
type discrepancy (bigint above, domain below) discourages the planner
from pushing down the WHERE condition.
There's a related complaint here:
http://archives.postgresql.org/pgsql-bugs/2005-10/msg00227.php
If we were to change things so that the result of the UNION were still
the domain, not plain bigint, then your example would be optimized the
way you want. I'm unsure about what other side-effects that would have
though.
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, michal.taborsky@mall.cz
Subject: Re: Searching union views not using indices
In-Reply-To: <15833.1131126787@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