dba_damion
asked on
oracle Select count(*)
Select count(*) is taking some time in oracle to run. This could is in a vendor enterprise system and they can not change the code to select count(row_id) with out sending us a new update. Is there a way to trick the database to intreprite select count(*) from mytable to select count(row_id) from mytable. This table has long datatype. I tried to do a shrink in the test database but it will not let you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can also think of increasing PARALLEL_EXECUTION_MESSAGE _SIZE or DB_FILE_MULTIBLOCK_READ_CO UNT=0, therefore while doing Parallelism or fulltable scan oracle will read more resp.
Can you do explain plan on that particular SQL (select count(*))? I'd expect to see Index FFS if you've an index on any of those fields. Like the above post it should read the INDEX to get the count and that should be fast. Did you check you stat? Is it up to date?
ASKER
virdi_ds
Adding primary key did it thank you
Adding primary key did it thank you
ASKER
Great
count(*) will definitely take lot more time if you have a long field in the table.