Re: [HACKERS] Need some help on code

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: M(dot)Boekhold(at)et(dot)tudelft(dot)nl
Cc: M(dot)Boekhold(at)ITS(dot)TUDelft(dot)NL, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Need some help on code
Date: 1998-06-08 15:16:20
Message-ID: 199806081516.LAA09082@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> My thinking was that the reading from the table is very scattered, but
> that the writing to the new table could be done 'sequentially'. Therefore
> I thought it was interesting to see if it would help to cluster the writes.
>
> > Often the fastest way is to discard the index, and just read the table,
> > sorting each in pieces, and merging them in. That is what psort does,
> > which is our sort code. That is why I recommend the SELECT INTO
> > solution if you have enough disk space.
>
> A 'select into ... order by ...' you mean?

Yes. See CLUSTER manual page:

Another way is to use SELECT ... INTO TABLE temp FROM
...ORDER BY ... This uses the PostgreSQL sorting code in
ORDER BY to match the index, and is much faster for
unordered data. You then drop the old table, use ALTER

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Massimo Dal Zotto 1998-06-08 15:17:52 Re: [HACKERS] backend now show status in 'ps'
Previous Message Massimo Dal Zotto 1998-06-08 14:53:10 Re: [HACKERS] keeping track of connections