Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VEzxq-0001tL-0K for pgsql-performance@arkaria.postgresql.org; Thu, 29 Aug 2013 11:00:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VEzxp-0004c3-Bp for pgsql-performance@arkaria.postgresql.org; Thu, 29 Aug 2013 11:00:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VEzxo-0004bw-6F for pgsql-performance@postgresql.org; Thu, 29 Aug 2013 11:00:32 +0000 Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VEzxg-0001uL-S9 for pgsql-performance@postgresql.org; Thu, 29 Aug 2013 11:00:31 +0000 Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by depesz.com with esmtpa (Exim 4.80) (envelope-from ) id 1VEzxe-00015z-M0; Thu, 29 Aug 2013 13:00:22 +0200 Date: Thu, 29 Aug 2013 13:00:22 +0200 From: hubert depesz lubaczewski To: fburgess@radiantblue.com Cc: pgsql-performance@postgresql.org Subject: Re: Poor OFFSET performance in PostgreSQL 9.1.6 Message-ID: <20130829110022.GA27417@depesz.com> Reply-To: depesz@depesz.com References: <20130828133946.5a830134ae84016b0174832fdc1a3173.53df957760.wbe@email11.secureserver.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20130828133946.5a830134ae84016b0174832fdc1a3173.53df957760.wbe@email11.secureserver.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -4.4 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Wed, Aug 28, 2013 at 01:39:46PM -0700, fburgess@radiantblue.com wrote: > Can anyone offer suggestions on how I can optimize a query that contains the LIMIT OFFSET clause? > The explain plan of the query is included in the notepad attachment. > thanks large offsets are slow, and there is no real escape from it. You can change your paging solution, though, to something that will be faster. Possible solutions/optimizations: http://www.depesz.com/2007/08/29/better-results-paging-in-postgresql-82/ or http://www.depesz.com/2011/05/20/pagination-with-fixed-order/ Best regards, depesz -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance