From: | John McKown <jmckown(at)prodigy(dot)net> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
Cc: | Paulo Roberto Siqueira <paulo(dot)siqueira(at)usa(dot)net>, PGSQL SQL <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Select subset of rows |
Date: | 2000-08-28 03:57:56 |
Message-ID: | Pine.LNX.4.21.0008272255030.15401-100000@linux2.johnmckown.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)bigpanda(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2000-08-28 04:16:04 | Re: Select subset of rows |
Previous Message | Yury Don | 2000-08-28 03:49:00 | Re: weird structure |