Forum Stats

  • 3,781,158 Users
  • 2,254,484 Discussions
  • 7,879,596 Comments

Discussions

Indexes

711094
711094 Member Posts: 2
edited Apr 9, 2010 4:11AM in SQL & PL/SQL
Hi all,

I think about if it does make sense to create an index on a column which only allows 2 different values. Here is my statement:

SELECT DISTINCT netz_nr
FROM adressen
WHERE ebene = nsp

In the column "ebene" of the table "adressen" are only the entries "nsp" or "msp", so does it makes sense with an index???

Thanks in advance! :-)

Colt

Answers

  • Toon Koppelaars
    Toon Koppelaars Member Posts: 2,607
    It depends...
    If you always seek for 'nsp', and that value is present on only a few rows (and the table has many rows), then it might help you.
    On the other hand of both values (nsp , and the other one) both appear on 50% each of the rows, it will not help you.
    Toon Koppelaars
This discussion has been closed.