索引& PHPMyAdmin 中的关键问题

发布于 2024-11-28 04:47:49 字数 294 浏览 0 评论 0原文

我有一些关于mysql的问题。我将 phpmyadmin 与它一起用作 xampp 包的一部分。

所以:

  1. 我为我的表定义了一个字段,该字段被标记为索引。一段时间后,我更改了该字段的名称,但注意到下面的键名保留为旧的我的名称。这是为什么?这会带来问题吗?

  2. 我还注意到,当在表中定义多个索引时,它们以某种方式聚集在一个键下,但只有字段显示一个在另一个之上。

我已经构建了一个数据库,但在进行这些更改之后,我不想错误地构建在不良的基础设施上。我应该重建吗?

I have some questions regarding mysql. I use phpmyadmin with it as part of the xampp package.

So:

  1. 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?

  2. 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏末的微笑 2024-12-05 04:47:49

键名称基本上仅供参考,对它们实际索引的字段没有影响。这些名称使您在使用它们(添加/修改/删除键)时更容易引用键,但除此之外它纯粹是提供信息的。如果您不提供键名称,MySQL 会自动分配键名称,并且通常基于键中的第一个字段。

不确定你所说的索引是什么意思。您必须显示您的 SQL,但是:

CREATE TABLE ...
...
INDEX indexA (fieldA, fieldB),
INDEX indexB (fieldC, fieldD),
INDEX indexC (fieldE)

将创建 3 个索引,其中两个索引分别覆盖两个字段。 () 内指定的任何字段名称都会成为该索引的一部分。

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.

×眷恋的温暖 2024-12-05 04:47:49

我认为你不应该重建。

关于你的第一个问题:
您所看到的是索引名称没有更改,但它仍然指向您重命名的字段

重新回答您的第二个问题:
不确定你所说的“在一个键下聚集在一起”是什么意思,如果仍然是一个问题,它可能是 myphp ui 的问题,你可以在此处发布屏幕截图。

一般来说,您会希望避免在表上创建大量索引,因为这会使插入和删除速度变慢。
删除索引是一种非破坏性操作,因此您可以进行所有您想要的实验,以找到最适合您的用例的模式。
如果您担心恋爱关系,您可能还想研究一下所谓的正常化

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文