Re:Insert with order by
Posted in 2007
Thanks Art,
It sounds logical.
I am just back from holidays.
Long N
====================
"ART KAGEL,
BLOOMBERG/ 731 To: ids@iiug.org
LEXIN" cc:
<kagel@bloomberg. Subject: Re:Insert with order by [9922]
net>
Sent by:
ids-bounces@iiug.
org
06/09/2007 11:25
PM
Please respond to
ids
If there is a good reason to have the table's contents sorted, say you
frequently retrieve 80-100% of the rows ORDER BY those columns, then after
loading the table ALTER an index on that key TO CLUSTER or create a CLUSTER
index on that key. That will sort the physical rows in the key order on
disk
to speed sequential access with a matching ORDER BY clause while the index
will
be used to guarantee that new rows are still returned in proper order even
though they will not be physically ordered.
Art S. Kagel
----- Original Message -----
From: Long Nguyen <ids@iiug.org>
To: ids@iiug.org
At: 9/05 22:37:40
Hi all,
In INFORMIX-SQL Version 7.32.FC2 I cannot run in dbaccess the following
statement
"insert into table_a select cust_code, co_code from strcustr ORDER BY
CUST_CODE" (resulting in syntax error 201).
But I can go around by "select cust_code, co_code from strcustr order by
cust_code INTO TEMP tmp1 with no log" and then
"insert into table_a select * from tmp1" to finally get sorted cust_codes
in table_a.
Is there any way to insert sorted cust_codes DIRECLTY from strcustr to
table_a? Or SQL 7.32 is a bit obsolete?
Thanks a lot
Long N.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Disclaimer:
This correspondence is for the named person's use only. It may contain
confidential or legally privileged information or both. No confidentiality
or privilege is waived or lost by any mistransmission. If you receive this
correspondence in error, please immediately delete it together with any
attachments from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended
recipient.
Any opinions expressed in this message are those of the individual sender,
except where the sender expressly, and with authority, states them to be
the opinions of Ruralco Holdings Limited or any of its subsidiaries
(collectively "Ruralco").
Although all care has been taken to screen this communication for viruses,
neither the sender nor Ruralco warrants that any communication via the
Internet is free of errors, viruses, interception or interference.
Information is distributed without warranties of any kind.