2007 Apr 21 8:22 AM
hi
while creating indexes , suppose if we created secondary index with the fields F1, F2, F3. while retrieving the data with select statement , can we mention the order of the fields like F2,F3,F1. If we assigned like that, is indexing concept is applicable for those fields?
hi
while creating indexes , suppose if we created secondary index with the fields F1, F2, F3. while retrieving the data with select statement , can we mention the order of the fields like F2,F3,F1. If we assigned like that, is indexing concept is applicable for those fields?
2007 Apr 21 10:20 AM
hi jyothsna
it is better if you give it in the same order. but i have tried this and found that in most of the cases the system picks up the index. but you can as well check it using ST05.
regards,
madhu
2007 Apr 21 11:46 AM
Hi Jyothsana,
Definely it will use the Index concept and pick the information using the index only. Once it retrieved the data from the DB then in the application server it will give the prefernce to the order of fields what you want.
Warm Regads,
Vijay
2007 Apr 23 5:13 AM
Hi Jyothsna,
Disadvantages:
Basically index are provided to improver performance. i.e with index select on db tables retrieves data much faster.
If you are writting select statement on the table where in where clause you have non-primary keys then it takes longer to retriev data from DB table.
If you have select in dbtable on non-primary key you can create Secondary index with keys as per your where clause which result in faster DB table access.
But remember not to create too many secondary indexes on same table which could result in slow / degrage performance..
you can check out the link below for more inforamation on indexes
http://www.idig.za.net/mysqlindexes/2006/11/09/
Advantages :
Secondary indexes are used to enhancement performance when retrieving data. For example, say you have a table AFKO where the key to the table is AUFNR. You can select data from this table using AUFNR, the performance will be great because you are using the key. Say you need to hit this table with GLTRP(finish date), it is not part of the key, so the performance would be poor. If you created a secondard index using this field GLTRP, the performance would be improved. Make sense?
https://forums.sdn.sap.com/click.jspa?searchID=1052972&messageID=1633228
http://help.sap.com/saphelp_470/helpdata/en/cf/21eb20446011d189700000e8322d00/frameset.htm
**********rewords some points.
Rgds,
P.Naganjana Reddy
2007 Apr 24 7:21 AM
Hai Jyothsna,
An existing index supports data selection from a table largely depends on whether the data selected with the index represents the data that will ultimately be selected. This can best be shown using an example.
An index is defined on fields FIELD1, FIELD2, FIELD3 and FIELD4 of table BSPTAB in this order. This table is accessed with the SELECT statement:
SELECT * FROM BSPTAB WHERE FIELD1 = X1 AND FIELD2 = X2 AND FIELD4= X4.
Since FIELD3 is not specified more exactly, only the index sorting up to FIELD2 is of any use. If the database system accesses the data using this index, it will quickly find all the records for which FIELD1 = X1 and FIELD2 = X2. You then have to select all the records for which FIELD4 = X4 from this set.
<b>The order of the fields in the index is very important for the accessing speed.</b> The first fields should be those which have constant values for a large number of selections. During selection, an index is only of use up to the first unspecified field.
Only those fields that significantly restrict the set of results in a selection make sense for an index.
The following selection is frequently made on address file ADRTAB:
SELECT * FROM ADRTAB WHERE TITEL = Prof. AND NAME = X AND VORNAME = Y.
The field TITLE would rarely restrict the records specified with NAME and FIRSTNAME in an index on NAME, FIRSTNAME and TITLE, since there are probably not many people with the same name and different titles. This would not make much sense in this index. An index on field TITLE alone would make sense for example if all professors are frequently selected.
Additional indexes can also place a load on the system since they must be adjusted each time the table contents change. Each additional index therefore slows down the insertion of records in the table.
For this reason, tables in which entries are very frequently written generally should only have a few indexes.
<b>The database system sometimes does not use a suitable index for a selection,</b> even if there is one. The index used depends on the optimizer used for the database system. You should therefore check if the index you created is also used for the selection (see How to Check if an Index is Used).).
<b>Creating an additional index could also have side effects on the performance.</b> This is because an index that was used successfully for selection might not be used any longer by the optimizer if the optimizer estimates (sometimes incorrectly) that the newly created index is more selective.
The indexes on a table should therefore be as disjunct as possible, that is they should contain as few fields in common as possible. If two indexes on a table have a large number of common fields, this could make it more difficult for the optimizer to choose the most selective index.
Hope this also helps you.
<b>Reward points if it helps you.</b>
Regds,
Rama chary.Pammi
2007 Apr 24 7:35 AM
Hi,
You need to Create the INDEX for those fields which you need to mention in the Where condition. Look at the below link to create the secondary indexes
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eb47446011d189700000e8322d00/content.htm
Regards
Sudheer
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |