Re: Pagination count strategies

From: Dorian Hoxha <dorian(dot)hoxha(at)gmail(dot)com>
To: Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com>
Cc: PostgreSql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Pagination count strategies
Date: 2014-04-03 14:01:39
Message-ID: CANsFX05Uh1vA768GTC+Z56aM7KSDXi2Yrs4Qnjz51_GvhLoPag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Cache the total ?

On Thu, Apr 3, 2014 at 3:34 PM, Leonardo M. Ramé <l(dot)rame(at)griensu(dot)com> wrote:

> Hi, in one of our systems, we added a kind of pagination feature, that
> shows N records of Total records.
>
> To do this, we added a "count(*) over() as Total" field in our queries
> in replacement of doing two queries, one for fetching the records, and
> other for getting the count. This improved the performance, but we are't
> happy with the results yet, by removing the count, the query takes
> 200ms vs 2000ms with it.
>
> We are thinking of removing the count, but if we do that, the system
> will lack an interesting feature.
>
> What strategy for showing the total number of records returned do you
> recommend?.
>
> Regards,
> --
> Leonardo M. Ramé
> Medical IT - Griensu S.A.
> Av. Colón 636 - Piso 8 Of. A
> X5000EPT -- Córdoba
> Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
> Cel.: +54 9 (011) 40871877
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2014-04-03 14:01:46 Re: Pagination count strategies
Previous Message Andrew Sullivan 2014-04-03 14:00:18 Re: Pagination count strategies