pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <pg@rbt.ca>
To: Thanks <Thanks@verymuch.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: pg_fetch_array
Date: Sun, 20 Jun 2004 16:02:17 -0400
Message-ID: <1087761736.64388.83.camel@jester> (raw)
In-Reply-To: <cajq71$2vku$1@news.hub.org>
References: <cajq71$2vku$1@news.hub.org>

> Does php need to read database everytime when pg_fetch_array is executed in
> the while loop or all the rows have been in the memory after pg_query?

You may need to ask the php people about this one. The PostgreSQL
protocol would allow data to continue streaming in at the same time as
you are processing other rows (asynchronous retrieval). So, optionally
they may fetch and cache all rows in local memory at pg_query OR grab
them in sets of 1000 rows and cache that (fetching the next set when the
first set runs out) OR grab one row for each fetch.

You could run a simple select that will fetch 100M rows from a table
with no WHERE clause. See how quickly the first row come in, and how
much memory is used by the process.

I suspect they call all of the rows at pg_query execution. Otherwise
they wouldn't know how to respond to a pg_num_rows() call.


On a side note, that is a rather unique email address.




view thread (3+ messages)  latest in thread

Message-ID: <1087761736.64388.83.camel@jester>
Permalink:  ../1087761736.64388.83.camel@jester/
Also on:    postgresql.org/message-id/1087761736.64388.83.camel@jester

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pg@rbt.ca, Thanks@verymuch.com
  Subject: Re: pg_fetch_array
  In-Reply-To: <1087761736.64388.83.camel@jester>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox