What is the SQL index name for?

后端 未结 6 588
深忆病人
深忆病人 2021-01-04 10:58

In SQL, when I create a database index, I\'m required to give the index a name, as in

CREATE INDEX timestamp_index ON hit (timestamp);

The

6条回答
  •  逝去的感伤
    2021-01-04 11:11

    I often feel the same way about filenames. Does an mp3 filename need to contain metadata (artist, album, is not a podcast, etc) when the file's attributes does a better job? The files on my ipod do not resemble the corresponding filenames on my hard drive because it uses an index and I wasn't required to think up a name for that index!

    Unlike a data element name, the name of an index is arbitrary. The ideal index is one that gets created and forever more 'looked after' by the system as the system knows best. Sadly, the reality is that on the rare occassions you may need to do something with it (e.g. drop it!). You could refer to a system dictionary to identify the index based on its attributes, usually just the columns it comprises.

提交回复
热议问题