is this possible? it should be!

Поиск
Список
Период
Сортировка
От newsreader@mediaone.net
Тема is this possible? it should be!
Дата
Msg-id 20010819134900.A8735@dragon.universe
обсуждение исходный текст
Ответы Re: is this possible? it should be!  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
Hello

I have statements (highly simplified just to get
the point across) like

select a,b,c from a where d=2 order by e limit 10;

Now I think that because of "order by" the above query
already "knows" the result of the below query

select count(*) from a where d=2;

The point is that I want to know the total number
of matches and I also want to use "limit".  And
I don't want to do two queries.

If it's impossible I would like to know whether
it costs the same to PG if I use it with or
without limit.

If I use DBI and simplified queries look like

$s=$dbh->prepare('select a,b,c from a where d=2 order by e ');
$s->execute();

I get the total number of rows by

$n=$s->rows;

I then use perl to implement "limit"

Thanks in advance for any hints


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Serial not so unique?
Следующее
От: David Wheeler
Дата:
Сообщение: OT: Design Books