Skip site navigation (1) Skip section navigation (2)

Re: [SQL] OFFSET impact on Performance???

From: PFC <lists(at)boutiquenumerique(dot)com>
To: alex(at)neteconomist(dot)com
Cc: "Greg Stark" <gsstark(at)mit(dot)edu>,"Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>,"Andrei Bintintan" <klodoma(at)ar-sd(dot)net>,pgsql-performance(at)postgresql(dot)org
Subject: Re: [SQL] OFFSET impact on Performance???
Date: 2005-01-27 09:54:25
Message-ID: opsk89szusth1vuj@musicbox (view raw or flat)
Thread:
Lists: pgsql-performance
> Thats a really good idea, just store a list of the sorted ids in the
> temp table - small amount of data for insert... I like it!
>
> Alex Turner
> NetEconomist

	The best part is that you can skip the LIMIT/OFFSET entirely if you put  
page numbers in your cache table while inserting into it, via a temporary  
sequence or something. Retrieving the results will then be very fast, but  
beware that SELECT * FROM table WHERE id =ANY( array ) won't use an index,  
so you'll have to trick the thing by generating a query with IN, or  
joining against a SRF returning the elements of the array one by one,  
which might be better.

In response to

Responses

pgsql-performance by date

Next:From: Richard HuxtonDate: 2005-01-27 10:18:35
Subject: Re: Optimizing Outer Joins
Previous:From: Sebastian BöckDate: 2005-01-27 08:19:38
Subject: Optimizing Outer Joins

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group