I would sat that it doesn't make any difference at all.Quote:
Originally Posted by dbasan
Printable View
I would sat that it doesn't make any difference at all.Quote:
Originally Posted by dbasan
Unless the PK is longer than another index, as might well be the case with a composite PK.Quote:
Originally Posted by dbasan
Oracle would prefer to fast full scan the smallest index, and if it's a choice between an index on a not-null varchar2(1) column and an index on a three-column primary key (or even a single-column date or numeric PK) then the smaller index will perform better.
Furthermore, counting the primary key column is not logically what you want, even if it guaranteed to give the same answer. What you want is the number of rows, and the appropriate syntax for that is count(*). Using count(pk_column) is an attempt to be tricky, just like using count(1), and to my mind that is also bad for easy understanding of the code.
use slimdave's suggestion + alter session to force parallel query.