2006 Dec 12 3:50 PM
Hi,
i use SAP on Oracle an i got a problem with an index.
My Table looks like that:
MANDT CLNT(3) Primary Key
Gsber CHAR(4) Primary Key
ItemID CHAR(38) Primary Key
OrderID NUMC(38)
Timestamp NUMC(14)
...
Now I have a few indexes:
Index1 - ( Mandt Gsber OrderID )
Index2 - ( Mandt Gsber Timestamp )
...
Now whenever i do a select like this:
SELECT * FROM mytable WHERE gsber = xx AND orderid = yy AND timestamp = zzthe index2 is taken, ignoring that index1 is much faster beacuse for any orderid there are max 4 entrys but for for any timestamp there are really lot of...
So i had a look for the statistics and found this:
NONUNIQUE Index1
Column Name #Distinct
MANDT 2
GSBER 29
ORDERID 3
NONUNIQUE Index2
Column Name #Distinct
MANDT 2
GSBER 29
TIMESTAMP 39.394
I understand distinct means diffrent rows...?!
So first index statistics are wrong, because i have much more distinct entrys.
I started table anlyse but same values still...
I dont want to use HINT in my select statements!
Does anyone have an idea why statistics are wrong?
Maybe problem with numc(38) in index?
Thanks for replies and ideas!
Benjamin Garn
2006 Dec 15 3:55 PM
Thank you for answers, but as i told u: Rebuild of statistics dont help. There is still the same wrong value in it.
Hi,
i use SAP on Oracle an i got a problem with an index.
My Table looks like that:
MANDT CLNT(3) Primary Key
Gsber CHAR(4) Primary Key
ItemID CHAR(38) Primary Key
OrderID NUMC(38)
Timestamp NUMC(14)
...
Now I have a few indexes:
Index1 - ( Mandt Gsber OrderID )
Index2 - ( Mandt Gsber Timestamp )
...
Now whenever i do a select like this:
SELECT * FROM mytable WHERE gsber = xx AND orderid = yy AND timestamp = zzthe index2 is taken, ignoring that index1 is much faster beacuse for any orderid there are max 4 entrys but for for any timestamp there are really lot of...
So i had a look for the statistics and found this:
NONUNIQUE Index1
Column Name #Distinct
MANDT 2
GSBER 29
ORDERID 3
NONUNIQUE Index2
Column Name #Distinct
MANDT 2
GSBER 29
TIMESTAMP 39.394
I understand distinct means diffrent rows...?!
So first index statistics are wrong, because i have much more distinct entrys.
I started table anlyse but same values still...
I dont want to use HINT in my select statements!
Does anyone have an idea why statistics are wrong?
Maybe problem with numc(38) in index?
Thanks for replies and ideas!
Benjamin Garn
2006 Dec 12 6:23 PM
Index is not generated automatically in SAP. If you have created the Index you need to generate/populate them. Try populating the Index and it will pick up the first index for you.
- Guru
Reward points for helpful answers
2006 Dec 12 6:54 PM
2006 Dec 13 1:00 PM
Hi,
there is transaction DB20, where you can see last run of statistics update (for a specific table) and trigger a new run.
Regards,
Christian
2006 Dec 15 3:55 PM
Thank you for answers, but as i told u: Rebuild of statistics dont help. There is still the same wrong value in it.
2006 Dec 15 4:07 PM
2006 Dec 18 8:25 AM
Hi Rob,
this note contained a link to note 365480 which pointed out my problem.
That's what i needed!
My Col was N(38) --> Varchar2(38) on Oracle.
Only first 32 characters are used for statistic.
Thank you!
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |