From: Gaetano Mendola <mendola@bigfoot.com>
To: pgsql-sql@postgresql.org
Subject: Re: Performance inside and outside view ( WAS Re: Select the max on a field )
Date: Thu, 12 Sep 2002 17:53:38 +0200
Message-ID: <alqd9s$mlb$1@news.hub.org> (raw)
References: <7350.1031842223@sss.pgh.pa.us>
"Tom Lane" <tgl@sss.pgh.pa.us> wrote in message
news:7350.1031842223@sss.pgh.pa.us...
> "Gaetano Mendola" <mendola@bigfoot.com> writes:
> > Yes that's right it's help me,
> > but here the optimizer have some problems:
>
> What's the datatype of id_user, and why are you quoting the compared
> constant in some cases but not others? I don't think the difference
> has anything to do with the view here ...
id_user is an INTEGER type.
Well what about this two selects:
a) SELECT DISTINCT ON (id_user) *
FROM user_logs
WHERE id_user = 5430
ORDER BY id_user, id_user_log DESC;
b) CREATE VIEW last_user_logs AS
SELECT DISTINCT ON (id_user) *
FROM user_logs
ORDER BY id_user, id_user_log DESC;
SELECT *
FROM last_user_logs
WHERE id_user = 5430
I think that in the second case the filter is not pushed inside the view.
Ciao
Gaetano
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-sql@postgresql.org
Cc: mendola@bigfoot.com
Subject: Re: Performance inside and outside view ( WAS Re: Select the max on a field )
In-Reply-To: <alqd9s$mlb$1@news.hub.org>
* 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