I have some questions regarding mysql. I use phpmya开发者_运维知识库dmin with it as part of the xampp package.
So:
I defined a field for my table that was marked marked as an index. After a while I changed the name of the field but noticed that down below the keyname was left as the old I'd name. Why is that? Does it impose a problem?
I noticed also that when defining more than one index in a table they somehow gather together under one key, but only the fields show one on top of the other.
I already built a db but after making those changes I don't want to build on bad infrastructure by mistake. Should I rebuild?
Key names are basically for reference and have no effect on what fields they're actually indexing. The names make it easier to refer to the key when you're working with them (add/modify/drop keys), but otherwise it's purely informational. MySQL will auto-assign a key name if you don't provide one, and it's generally based on the first field within the key.
Not sure what you mean about the indexes. You'd have to show your SQL, but:
CREATE TABLE ...
...
INDEX indexA (fieldA, fieldB),
INDEX indexB (fieldC, fieldD),
INDEX indexC (fieldE)
would create 3 indexes, two of which cover two fields each. Any field names specified inside the ()
become part of that one index.
I dont think you should rebuild.
Re your first question: What your seeing is an index name hasn't changed but it still points to that field you renamed
Re your second question: Not sure what you mean by " gather together under one key," it could be a myphp ui thing if it iss still a concern you can post a screen capture here.
In general you would want to avoid creating lots of indexes on a table cus it would make insertion and deletion slower. Dropping indexes is a none destructive operation so you can experiment with it all you want to find the most preformant schema for your use case. You might also want to look into something called normalization if your concerned with pref romance
精彩评论