Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 45C8E632F22 for ; Thu, 13 May 2010 10:58:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 15333-01 for ; Thu, 13 May 2010 13:58:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.magwerks.com (mail.magwerks.com [209.248.233.131]) by mail.postgresql.org (Postfix) with ESMTP id 313BF632EF6 for ; Thu, 13 May 2010 10:58:35 -0300 (ADT) Received: from [192.168.1.36] by mail.magwerks.com (GMS 15.01.3664/RS2750.00.1b502c7c) with ESMTP id szzoeaaa for pgsql-sql@postgresql.org; Thu, 13 May 2010 09:58:33 -0400 Message-ID: <4BEC0564.7020403@magwerks.com> Date: Thu, 13 May 2010 09:57:56 -0400 From: Justin Graf User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: pgsql-sql@postgresql.org, vindex+lists-pgsql-sql@apartia.org Subject: Re: best paging strategies for large datasets? References: <20100512054144.GA8762@apartia.fr> <4BEAD6A9.5040906@magwerks.com> <20100513074353.GA19779@apartia.fr> In-Reply-To: <20100513074353.GA19779@apartia.fr> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-AntiSpam: Checked for restricted content by Gordano's AntiSpam Software X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.105 tagged_above=-5 required=5 tests=BAYES_50=0.8, SARE_MILLIONSOF=0.315, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: * X-Archive-Number: 201005/64 X-Sequence-Number: 34112 On 5/13/2010 3:43 AM, Louis-David Mitterrand wrote: **snip*** > >> What do you mean by quite slow?? >> > Like several seconds. I have to cache the results. > Well then i suggest posting the queries to Performance or here and let us take a look them don't forget to include the explain/analyze, and number of records in each table. >> On a 30K record table count() and query speed should not be a problem.. >> > This query is a large multi-join of times series data, not a single > table. And it's not (prematurely :) optimized. > > I'm planning a materialized view for it. > here read this http://www.pgcon.org/2008/schedule/events/69.en.html The question that begs to be asked how big are the tables the query is accessing?? if its not hundreds of thousands to millions of records or on a stone age Server , my guess is the query can be improved. > **snip** >> RecordCount/Limit = Number of pages >> CurrentPage = (offset%RecordCount)/Limit >> > These simple formulas we bill handy. > don't forget to use floor on these in what ever language your programming in All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by our proprietary quotation system. Quotations received via any other form of communication will not be honored. CONFIDENTIALITY NOTICE: This e-mail, including attachments, may contain legally privileged, confidential or other information proprietary to Magwerks Corporation and is intended solely for the use of the individual to whom it addresses. If the reader of this e-mail is not the intended recipient or authorized agent, the reader is hereby notified that any unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this e-mail immediately. Thank you.