X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 709EFD1C48E for ; Wed, 6 Aug 2003 16:06:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 43971-10 for ; Wed, 6 Aug 2003 13:05:35 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 41B37D1C4BF for ; Wed, 6 Aug 2003 13:06:46 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h76G4sMY004179; Wed, 6 Aug 2003 10:04:54 -0600 (MDT) Date: Wed, 6 Aug 2003 09:51:21 -0600 (MDT) From: "scott.marlowe" To: Andreas Schmitz Cc: Subject: Re: Using Cursors in PHP In-Reply-To: <200308061459.22825.a.schmitz@cityweb.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/15 X-Sequence-Number: 2192 On Wed, 6 Aug 2003, Andreas Schmitz wrote: > > Hello *, > > I am just wondering if it is possible to use cursors within PHP. I need to > page query result from a big table and I am looking for a solution to avoid > scanning the complete table using limit and offset. Yes, you can use cursors, no you can't expect them to survive from one page to the next. Luckily, Postgresql is smart enough to use indexes when you use offset limit, but, of course, it must internally create the result set up to and including the last row returned by the limit / offset.