Numbering of promary keys in sorted order
Posted in 2007
Hello, all
I need help to get an ascending serial number (INT8)
and a primary key in sorted order into a helper table.
As long as intermediate tables are not to be fragmented,
a solution along these lines did work:
SELECT PK from source INTO TEMP helper ORDER by 1;
Insert INTO raw_helper
CREATE raw_helper table
with serial and column for the PK of source
as a RAW table to make it faster.
INSERT INTO raw_helper .... SELECT from temp table.
But as soon as the temp table is fragmented and the
RAW table has FRAGMENT BY EXPRESSION
there is no more ascending order in the PK copies, if selected
ORDER BY serial_column.
I therefore believe, that the sort order with small amounts of rows
was a side effekt, one can not relay on.
I posted this very same subject a few days ago and the
question I _should_ ask is rather:
ow to simulate the forbidden
INSERT INTO .... SELECT FROM
and ORDER BY at the same time.
All help appreciated.
dic_K
--
Richard Kofler
SOLID STATE EDV
Dienstleistungen GmbH
Vienna/Austria/Europe