将索引添加到mysql中的列 [英] Adding Index to column in mysql

查看:83
本文介绍了将索引添加到mysql中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用PHPmyadmin创建索引?

How do I create an index with PHPmyadmin?

我有一个5,000行的数据库

I have a database with 5,000 rows of

ID | IP | DATE

在向该表添加数据之前,我将id作为主键,

Before added data to this table I made id as Primary Key,

网站使用以下查询:

mysql_query("SELECT * FROM users WHERE ip = '$ip'");

我今天读到,索引可以加快性能, 在我的情况下,我需要如何向IP列添加索引,

I read today that indexes can speed up and performance, and in my case how do i need to add index to IP column,

我要使用phpmyadmin并执行操作,我看到添加唯一索引"和添加索引"选项, 我是新手,感谢您的帮助,谢谢.

I am to phpmyadmin and to actions I see "Add unique index" and "Add index" options, Im new in this, appreciate your help, thank you.

推荐答案

单击ip行中显示索引"的图标. (这是带有闪电的那个).不要选择primary keyunique.只是索引.

Click on the icon that says "index" in the row for ip. (It's the one with the lightening bolt). Don't choose primary key or unique. Just index.

这篇关于将索引添加到mysql中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆