Re: [HACKERS] Need some help on code

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] Need some help on code
Дата
Msg-id 199806081516.LAA09082@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Need some help on code  (Maarten Boekhold <maartenb@dutepp0.et.tudelft.nl>)
Список 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@candle.pha.pa.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)

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Doug Lo
Дата:
Сообщение: Re: [HACKERS] Re: [GENERAL] Should I run regression tests?
Следующее
От: Oleg Broytmann
Дата:
Сообщение: Re: [HACKERS] backend now show status in 'ps'