I have a Innodb table with a index that looks at 3 columns.

  • ColA is integer and always has a value.
  • ColB is varchar and always has a value.
  • ColC is datetime and sometimes has a value (NULL).

My index appears to be looking at all records representing ColA,B,C (NULL or NOT NULL).

Is it possible to have the index only store ColC NULL values? This would shorten the index considerably (ie 27K to 1K).

  • 1
    Do you mean that you need the index only for queries with WHERE c IS NULL? You never have other queries involving column c? – ypercubeᵀᴹ Apr 22 '14 at 18:10
  • Yes. Only when C IS NULL. – John M Apr 22 '14 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.