I know the bad way...what is the good way?

From: Rick Schumeyer <rschumeyer(at)ieee(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: I know the bad way...what is the good way?
Date: 2006-11-03 14:06:00
Message-ID: 454B4CC8.4070705@ieee.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I confess to having once written code that prints something like
"Items # 1 to 10 of 45"
by using select count(*) from t where condition; and select * from t
where condition limit 10 offset x;

I now know this is "bad", I guess because of the count() and the offset.

So what is the preferred way? If it matters, my new application is
servlet based, so I believe (but not positive) this means cursors are an
option? Is this a better way to do this?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Troy 2006-11-03 14:15:21 Re: Counting records in a PL/pgsql cursor
Previous Message Jorge Godoy 2006-11-03 13:48:55 Re: Isolation / Visibility inside a trigger