SaranacLake Posted February 23, 2020 Share Posted February 23, 2020 Do you name your Indexes in MySQL? If so, what naming convention do you use? Quote Link to comment Share on other sites More sharing options...
Barand Posted February 23, 2020 Share Posted February 23, 2020 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" Quote Link to comment Share on other sites More sharing options...
SaranacLake Posted February 23, 2020 Author Share Posted February 23, 2020 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...) Quote Link to comment Share on other sites More sharing options...
requinix Posted February 23, 2020 Share Posted February 23, 2020 23 minutes ago, Barand said: I name mine after Harry Potter characters. That's so Hufflepuff. Quote Link to comment Share on other sites More sharing options...
Barand Posted February 23, 2020 Share Posted February 23, 2020 To me it sounds like I don't name them because they will be given reasonable names automatically Quote Link to comment Share on other sites More sharing options...
SaranacLake Posted February 23, 2020 Author Share Posted February 23, 2020 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? Quote Link to comment Share on other sites More sharing options...
kicken Posted February 24, 2020 Share Posted February 24, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.