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


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to