Re: How do the records retrieve from data base when using sql statements?
- From: "Saml" <none@xxxxxxxxxxxxxxx>
- Date: Wed, 25 Jun 2008 20:45:46 -0400
Just use an order by clause. As Chuck said, SQL does not specify which
order records will be returned in unless you use an order by clause.
Even if you have a cluster index for Sybase are you sure that records are
guaranteed to be returned in the correct order in you don't specify an order
by clause?
You can do a RGZPFM command on an AS/400 table and specifically tell it to
put the physical records in the same sequence as a specified key. This is
good until the next record is inserted, but combined with an order by clause
it will probably improve performance even if some records are out of
sequence. And if you have the machine time, you can re-do the RGZPFM on a
regular basis to keep your data tuned.
Bear in mind that organzing it physically one way may impact performance for
other queries. And the usual caveat: It depends on how many records in the
file and how many you are retrieving.
(I admit to mild curiosity about why you don't seem to want to specify an
order by. Or maybe you have a serious performance problem that you are
trying to solve. If so, I'm mildy curious about what it is.)
Sam
"AMOS" <am12348@xxxxxxxxx> wrote in message
news:cdd5d2d8-c52a-4097-ad5e-de2bc73623e4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 23 ????, 06:54, "Hau...@xxxxxxxxxxxxxxx" <Hau...@xxxxxxxxxxxxxxx>
wrote:
In either way avoid specifying any DDS described logical file in an
SQL statement.
For more information about indexing read the following White Paper:
Indexing and statistics strategies for DB2 for
i5/OShttp://www-03.ibm.com/servers/enable/site/education/abstracts/indxng_...
Birgitta
Hello Brigitta,Sam and Chuck,
Thank you for your useful explanations
Upon reading your responses, the data in physical files are not
necessarily located
according to the keys values sequence. Therefore the optimizer does
not use them necessarily in order to retrieve the records.
I'm working with Sybase too. I know that you can define cluster
indexes on tables.
This means that the keys are located continuously and every "insert"
operation reorganize them again.
My question is, if there is a possibility to define keys for physical
files in AS400 in such way.
Thank you,
Amos
.
- References:
- How do the records retrieve from data base when using sql statements?
- From: AMOS
- Re: How do the records retrieve from data base when using sql statements?
- From: Saml
- Re: How do the records retrieve from data base when using sql statements?
- From: AMOS
- Re: How do the records retrieve from data base when using sql statements?
- From: Hauser@xxxxxxxxxxxxxxx
- Re: How do the records retrieve from data base when using sql statements?
- From: AMOS
- How do the records retrieve from data base when using sql statements?
- Prev by Date: Good Starter Book on SQL for AS/400 or iSeries systems
- Next by Date: Re: Idetifying file/keys created by the SQL optimiser.
- Previous by thread: Re: How do the records retrieve from data base when using sql statements?
- Next by thread: Re: How do the records retrieve from data base when using sql statements?
- Index(es):
Relevant Pages
|