From: John McKown <jmckown@prodigy.net>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: Paulo Roberto Siqueira <paulo.siqueira@usa.net>
Cc: PGSQL SQL <pgsql-sql@postgresql.org>
Subject: Re: Select subset of rows
Date: Sun, 27 Aug 2000 22:57:56 -0500 (CDT)
Message-ID: <Pine.LNX.4.21.0008272255030.15401-100000@linux2.johnmckown.net> (raw)
In-Reply-To: <Pine.BSF.4.10.10008271404001.47801-100000@megazone23.bigpanda.com>
On Sun, 27 Aug 2000, Stephan Szabo wrote:
>
> Of course immediately after sending the last message and logging off my
> ISP I figured out the simpler way for the third one:
>
> begin;
> select salary into temp saltemp from employee order by salary desc
> limit 5;
> select name from employee where exists (select * from saltemp where
> saltemp.salary=employee.salary);
> end;
>
> Stephan Szabo
> sszabo@bigpanda.com
>
I wonder if the following might be a bit faster? Or would it be slower?
select salary into temp saltemp from employee order by salary desc
limit 5;
select min(salary) as minsal into test minsal from saltemp;
select name, salary from employee, minsal
where salary >= minsal;
I don't know the speed difference between my second select and your
subselect within an EXISTS clause might be.
Just a thought,
John
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jmckown@prodigy.net, sszabo@megazone23.bigpanda.com, paulo.siqueira@usa.net
Subject: Re: Select subset of rows
In-Reply-To: <Pine.LNX.4.21.0008272255030.15401-100000@linux2.johnmckown.net>
References: <Pine.BSF.4.10.10008271404001.47801-100000@megazone23.bigpanda.com> <Pine.LNX.4.21.0008272255030.15401-100000@linux2.johnmckown.net>
* 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