Jump to content

Naming Indexes

Recommended Posts

2 minutes ago, Barand said:

I name mine after Harry Potter characters.

However if I create an index without a name using MySQL Workbench it auto names it for me. If I index column yyy in table xxx it gives it the name "idx_xxx_yyy"

So it doesn't sound like you find value in naming your indexes?  (I take the first comment to be sarcasm...)


Link to post
Share on other sites
6 minutes ago, Barand said:

To me it sounds like I don't name them because they will be given reasonable names automatically

Is there a need to know an indexes name so that you can refer to it, or is it a MySQL internal that no one really cares about?

Link to post
Share on other sites
5 hours ago, SaranacLake said:

Is there a need to know an indexes name so that you can refer to it

There are a few reasons you might want to know the name (index hints, changing the index, etc), but all are fairly rare so it's not really important that you name them explicitly.  If you need the name, you could always look it up later.

I tend to name my indexes and constraints just to be explicit.  I use the format IX_table_name_column_name to keep things simple.


  • Like 1
Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.