Thanks a lot!!
mrunmayi kusurkar, January 16, 2017 - 12:17 pm UTC
Thanks a lot for quick response.. its truly useful..
Question on DBA_INDEX_USAGE and gather stats
AnĂbal, November 04, 2021 - 3:30 pm UTC
Hi guys, is there a way to distinguish an index being used by a gathering stats procedure than one being used by a sql statement in DBA_INDEX_USAGE?
November 09, 2021 - 3:40 am UTC
Not really, but perhaps you could do an approximation, ie
You could use stats history to determine how many times you have gathered stat on this index , and gather stats scans the entire index (assuming you are using the default AUTO method).
If the number of entries in the index is (say) 600, then you know that if you have gathered stats 3 times, then you will have 3 "erroneous" counts in the BUCKET_101_1000_ACCESS_COUNT column, and 3x600 excess in the BUCKET_101_1000_ROWS_RETURNED column.
You could remove these to get a slightly better estimate of index usage.
BUCKET_1000_PLUS_ACCESS_COUNT
Mansi, April 25, 2022 - 11:05 am UTC
I hav been keeping eye on DBA_INDEX_USAGE for few indexes and it was last used in somewhere in Dec-21. Now that when I see its on 08-APR-22.
I dont think its getting used anywhere, but gather stats happend near 08-APR-22.
I came to this post if is there any way to confirm that. You say there should be only 1 count for 1 gather stats, I can see the count is 200 and 52 in 2 indexes I have been monitoring. Is it possible in gahter stat?
P.S. table has 609861237 rows returned.
April 25, 2022 - 2:09 pm UTC
Where exactly are you seeing these values? What were the values before stats were gathered?
BUCKET_101_1000_ACCESS_COUNT
A reader, April 26, 2022 - 7:45 am UTC
I am not sure about the previous values, I only checked that it was not used since long time. checked the last _USED_date.
and now BUCKET_101_1000_ACCESS_COUNT has this counts and
last _USED_date is 8th apr. Also total count (*) in BUCKET_1000_PLUS_ROWS_RETURNED.
April 28, 2022 - 4:22 am UTC
A way of cross-checking would be to check v$sql_plan and the equivcalent DBA_HIST_... tables for sql statements that reference this index.
If you can't find any, then perhaps explore setting it to invisible and monitoring for any regressions.
BUCKET_1000_PLUS_ACCESS_COUNT
Mansi, April 26, 2022 - 7:47 am UTC
I am not sure about the previous values, I only checked that it was not used since long time. checked the last _USED_date.
and now BUCKET_1000_PLUS_ACCESS_COUNT has this counts and
last _USED_date is 8th apr. Also total count (*) in BUCKET_1000_PLUS_ROWS_RETURNED.