is this possible? it should be! - Mailing list pgsql-general

From newsreader@mediaone.net
Subject is this possible? it should be!
Date
Msg-id 20010819134900.A8735@dragon.universe
Whole thread Raw
Responses Re: is this possible? it should be!
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Serial not so unique?
Next
From: David Wheeler
Date:
Subject: OT: Design Books