Re: Cursors: getting the number of tuples; moving backwards

From: am(at)fx(dot)ro
To: pgsql-general(at)postgresql(dot)org
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, am(at)fx(dot)ro, pgsql-general(at)postgresql(dot)org
Subject: Re: Cursors: getting the number of tuples; moving backwards
Date: 2002-11-02 19:33:43
Message-ID: 20021102213342.A292@coto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-jdbc

On Fri, Nov 01, 2002 at 10:03:17PM -0500, Tom Lane wrote:
> MOVE does execute the query, it just doesn't ship the tuples to the
> client. This would save some formatting overhead (no need to run
> the datatype I/O conversion procedures), but unless you have a slow
> network link between client and server I would not expect it to be
> "much" faster ...

It must be the fact that the computer is quite old : Cyrix 6x86 166Mhz.
( this is not the deplyoment machine ).

Using MOVE is about 5 times faster in my case :
For 150784 tuples in the table, FETCH-ing took about 1m30 ,
while MOVE-ing took only about 17sec.

| Real | User | Sys
-------------------------------------------------------------------
select * from PRODTEST | 1m30.843s | 0m42.960s | 0m1.720s
-------------------------------------------------------------------
declare cursor... + FETCH | 1m32.835s | 0m42.680s | 0m1.780s
-------------------------------------------------------------------
declare cursor... + MOVE | 0m17.215s | 0m0.030s | 0m0.030s
-------------------------------------------------------------------
( i used commands like: time psql -f test.sql db_rex
to get those timings )

The difference must be smaller on fast machines.

So i guess that my computer is pretty good when it comes to finding
performance problems in applications ;-)

Bye,
Adrian Maier
(am(at)fx(dot)ro)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message miguel angel rojas aquino 2002-11-02 22:25:53 OT : timestamps and jbuilder (help, please)
Previous Message Ron St-Pierre 2002-11-02 17:36:45 Constraint Problem

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-11-02 20:17:29 Re: "Cache lookup failed for relation 16905" ??
Previous Message Steve Howe 2002-11-02 19:02:26 Re: "Cache lookup failed for relation 16905" ??

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2002-11-02 22:26:22 Re: DatabaseMetaData.getTables() problem
Previous Message Tom Lane 2002-11-02 15:06:35 Re: move 0 behaviour