473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Data of table not sorted by primary index in Control Center

Why is that even though I have added index with DESC sort order on
primary key, records in Control Center are displayed by the sequence
they were previously inserted, not by the value of primary key?
If I perform REORG on table primary index, records get sorted by
primary index properly. But when I enter new records afterwards, the
new ones appear again sorted in sequence they were inserted into table.
Why?

Dec 5 '05 #1
3 2135
Ian
Antanas wrote:
Why is that even though I have added index with DESC sort order on
primary key, records in Control Center are displayed by the sequence
they were previously inserted, not by the value of primary key?
If I perform REORG on table primary index, records get sorted by
primary index properly. But when I enter new records afterwards, the
new ones appear again sorted in sequence they were inserted into table.


SQL is set-based, and unless you specify an ORDER BY clause, there is
no guarantee that you'll get records back in any specific order.

The fact that you do get them in a noticeable order (i.e. order that
records were added or PK-order after the REORG) is "coincidence." (It
may be reproducible now, but other changes to your database and/or
config have a good chance of changing this.)

Good luck,
Dec 5 '05 #2

Ian wrote:
Antanas wrote:
Why is that even though I have added index with DESC sort order on
primary key, records in Control Center are displayed by the sequence
they were previously inserted, not by the value of primary key?
If I perform REORG on table primary index, records get sorted by
primary index properly. But when I enter new records afterwards, the
new ones appear again sorted in sequence they were inserted into table.


SQL is set-based, and unless you specify an ORDER BY clause, there is
no guarantee that you'll get records back in any specific order.

The fact that you do get them in a noticeable order (i.e. order that
records were added or PK-order after the REORG) is "coincidence." (It
may be reproducible now, but other changes to your database and/or
config have a good chance of changing this.)

Good luck,


The indexes are always in the exact order of the index key. Table rows
are only in order of an index after a reorg (if you specify an index to
be used in the reorg, or the table has a clustered index defined).

Dec 5 '05 #3
m0****@yahoo.com wrote:

Ian wrote:
Antanas wrote:
> Why is that even though I have added index with DESC sort order on
> primary key, records in Control Center are displayed by the sequence
> they were previously inserted, not by the value of primary key?
> If I perform REORG on table primary index, records get sorted by
> primary index properly. But when I enter new records afterwards, the
> new ones appear again sorted in sequence they were inserted into table.


SQL is set-based, and unless you specify an ORDER BY clause, there is
no guarantee that you'll get records back in any specific order.

The fact that you do get them in a noticeable order (i.e. order that
records were added or PK-order after the REORG) is "coincidence." (It
may be reproducible now, but other changes to your database and/or
config have a good chance of changing this.)


The indexes are always in the exact order of the index key. Table rows
are only in order of an index after a reorg (if you specify an index to
be used in the reorg, or the table has a clustered index defined).


And even that does not imply _any_ order for a simple SELECT ... FROM
<table>. The _only_ way to enforce a specific ordering is the ORDER BY
clause.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Dec 6 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most...
9
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with...
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
5
by: Bing Wu | last post by:
I have a user defined tablespace: Tablespace ID = 4 Name = DATASPACE Type = Database managed space...
2
by: John Holmes | last post by:
I am using radioButton controls in a data repeater and would like to incorporate the 'key' field into the 'id' attribute of the radioButton controls and name them something like: 'rad' + '<%#...
0
by: Jerry | last post by:
Below is ALL the code for all the databases... Here's the problem: I callup the aspx file in IE and the form comes up just fine. When I select a person to update, I get the subject error. ...
1
by: rsteph | last post by:
I've got a page with a menu div that is 1066px wide by 150px high. And then I have some images that are 150px by 150px for the menu items. I put the images in a table that is set to 150x150px with a...
2
by: lindabaldwin | last post by:
Hi there all you smarter than me people! I am stuck. I have been working on this database for days and cannot figure out how to solve my problem. I have a form with two embedded subforms. The...
2
by: Ashley | last post by:
hey, what's up............................. "Neil" <nospam@nospam.netwrote in message news:8YFwj.10509$0o7.1113@newssvr13.news.prodigy.net...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.