Search Optimisation - NULL vs Empty String

  • Hi,

    We are re-structuring our database for various reasons. We have generated the new tables to replace the old ones and have back-populated the data (approx 250m records).

    There are a number of fields that are indexed as they are used for searching. I have noticed however, that the fields with no data have been populated with empty strings, rather than NULLs. Is this going to hamper performance? From experience, NULL columns are faster, I would assume because they are ignored by the index?

    If anyone can confirm either way, that'd be great.

    Thanks

  • You are correct, most rdbms ignore null values when indexing.

    Having said that, there is a huge conceptual difference in between an empty string and a null value. An empty string tells there is nothing there - which believe it or not it is a value 🙂 while a null value tells that the value is currently unknown.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply