X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAEE63A5E1F for ; Thu, 27 Jan 2005 10:34:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37493-02 for ; Thu, 27 Jan 2005 10:34:06 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id CD62F3A5E08 for ; Thu, 27 Jan 2005 10:34:00 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j0RAX05Q028730; Thu, 27 Jan 2005 13:33:00 +0300 (MSK) Date: Thu, 27 Jan 2005 13:33:00 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: PFC Cc: alex@neteconomist.com, Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? In-Reply-To: Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.369 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/530 X-Sequence-Number: 10220 On Thu, 27 Jan 2005, PFC wrote: > >> 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 contrib/intarray provides index access to such queries. > 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. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83