performance - Database indices that cover only one value -


itemprop = "text">

I have a large table (millions of records) in which some hundreds of thousands of numbers boolean fields (instead of 0 = 1)

I only care about those records which are true (value = 1). Is there a way to create an index that 'indexes' these records? What kind of index should I use?

  Select Count (*) from records where boolean_field = 1   

environment: Oracle 10G (but also

If your "false" value is zero instead of zero, you can get the result you want Otherwise, you can create a function-based pointer like this: index IDX (case boolean_field when 1 again 1 end) on create records;

This will only be an index of 1s But for Oracle, your questions should be used in your questions:

  Choose from the record where the case boolean_field when 1 then 1 end = 1;  < / Pre>  

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -