count and limit

From: "Fabio Victora Hecht" <fabiovh(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: count and limit
Date: 2006-08-17 21:12:31
Message-ID: d2bb3d100608171412y7d498f5fu81639c3a6548783c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I've been using Postgresql for a while now and I'm very satisfied.

I was wondering if there's a way to count the results of a query and return
part of the result set it in one query (LIMIT). Because I usually have to
count the results using one query (to tell the user how many records match
the criteria) and show the first 20 records.

It seems to me that could be optimized, because the database has to fetch
the results to count, then again to return the page.

Hope I'm clear enough.

Thanks.

Fabio.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dawid Kuroczko 2006-08-17 21:14:09 Re: Best approach for a "gap-less" sequence
Previous Message Dwight Emmons 2006-08-17 21:06:51 Cast null string '' to integer 0