Hello guys,
I'm back with a new question. I hope that you can help... I have a table with about 30 milion records. It has about 30 fields. Basically, it's not a huge table. I have tables with more records. But what I don't understand is why it takes so long to do a COUNT(*).
I have a UNIQUE index on the table which a compound index on 3 attributes. And when I check the plan, the index is correctly used to COUNT.
Plan hash value: 2669145199
---------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
---------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 16960 (7)| 00:02:24 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | INDEX FAST FULL SCAN| WORKFLOW_TASK_DOCUM_ID_IDX | 29M| 16960 (7)| 00:02:24 |
---------------------------------------------------------------------------------------------
Don't trust that time. Because, it says 2minutes and 24 seconds. But in reality, it takes around 30 minutes. So I was wondering if any of you had an idea? Honestly, my query is just a SELECT COUNT(*) FROM MY_TABLE;
Thanks,