Re: AW: Inserting a select statement result into another ta ble

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: AW: Inserting a select statement result into another ta ble
Дата
Msg-id 1633.971497330@sss.pgh.pa.us
обсуждение исходный текст
Ответ на AW: Inserting a select statement result into another ta ble  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
Список pgsql-hackers
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
>> This is an interesting idea.  We don't allow ORDER BY in 
>> INSERT INTO ...
>> SELECT because it doesn't make any sense, but it does make sense if
>> LIMIT is used:

> An "order by" also makes sense if you want to create a presorted table
> for faster access. I don't see why we should disallow it.

In current sources:

regression=# insert into int4_tbl select * from int4_tbl order by f1;
INSERT 0 5
regression=# select * from int4_tbl;    f1
-------------          0     123456    -123456 2147483647-2147483647-2147483647         <<= insertion starts here
-123456         0     123456 2147483647
 
(10 rows)

LIMIT won't work without some further code-rejiggering, but I think
it should be made to work eventually.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan