Re: Replication Ideas

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Replication Ideas
Date: 2003-08-25 22:28:09
Message-ID: m3brud9xty.fsf@chvatal.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-performance

A long time ago, in a galaxy far, far away, "Bupp Phillips" <hello(at)noname(dot)com> wrote:
>I have a table that has 103,000 records in it (record size is about
>953 bytes) and when I do a select all (select * from <table>) it takes
>a whopping 30 secs for the data to return!!

>SQLServer on the other hand takes 6 secs, but you can also use what is
>called a firehose cursor, which will return the data in < 1 sec.

>I have done everything that I know how to speed this up, does anyone
>have any advise?

Have you VACUUMed the table? 30 seconds to start getting data back
from such a query _seems_ a liittle high.

It would be quite a reasonable idea to open up a CURSOR and request
the data in more byte-sized pieces so that the result set wouldn't
forcibly bloat in any one spot.

You start by submitting the cursor definition, inside a transaction:
begin transaction;
declare cursor my_fire_hose for select * from <table>;

You then iterate over the following, which fetches 1000 rows at a time:
fetch forward 1000 in my_fire_hose;

That should cut down the time it takes to start getting records to
near enough to zero...
--
output = reverse("gro.gultn" "@" "enworbbc")
http://www3.sympatico.ca/cbbrowne/lisp.html
"Microsoft is sort of a mixture between the Borg and the
Ferengi. Combine the Borg marketing with Ferengi networking..."
-- Andre Beck in dcouln

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Claudio Lapidus 2003-08-25 22:28:33 Re: [ADMIN] a problem
Previous Message Greg Stark 2003-08-25 22:27:54 Re: move to usenet?

Browse pgsql-hackers by date

  From Date Subject
Next Message Nguyen Tran Quoc Vinh 2003-08-25 23:54:12 Need Documentation(information) about PostgreSql's structure
Previous Message Stephan Szabo 2003-08-25 22:23:47 Re: postgresql 7.3.2 bug on date '1901-12-13' and '1901-12

Browse pgsql-performance by date

  From Date Subject
Next Message Marc G. Fournier 2003-08-26 06:01:26 Re: Replication Ideas
Previous Message Chris Travers 2003-08-25 22:15:25 Re: Replication Ideas