由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - indexing就是设置primary key吗?
相关主题
请教 sql server index问题请问MySQL 可以快速处理table有1亿条数据么?
关于MSSQL, 问几个比较土的问题index请教
被人鄙视了两个列联合作Primary Key,还需要单独建index吗?
SQL 2008 Create Index vs Rebuild Index (Alter Index)Join optimization
SQL 2000 create index 問題MySQL 5.0 cluster question
请教三个Key的property,如何决定index
面试问题How would you improve table insert performance? (give five or more ideas)怎样解决 Index for NULL value
为啥RDBMS只用一个Index? (转载)问个Index的问题
相关话题的讨论汇总
话题: index话题: clustered话题: primary话题: pk话题: key
进入Database版参与讨论
1 (共1页)
I*****y
发帖数: 6402
1
在建mysql数据库table的时候,因为read这个表格多于insert, 想弄一个index, 根据我
现在的理解就是设置primary key, 请问这样理解对吗?
B*****g
发帖数: 34098
2
http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html

据我

【在 I*****y 的大作中提到】
: 在建mysql数据库table的时候,因为read这个表格多于insert, 想弄一个index, 根据我
: 现在的理解就是设置primary key, 请问这样理解对吗?

j*****n
发帖数: 1781
3
not sure for mysql, but for MSSQL, if you specify a primary key, it will
automatically create a clustered index for you.
anyway, indexing is different thing with your PK...
get your knowledge updated by read some database fundamental books please.
w*******e
发帖数: 1622
4
准确的说是: 如果没clustered Index, 那么it will automatically create a
clustered index on the PK for you.
如果有个clustered index 存在了, 那就是automatically create a non-clustered
index on that PK for you.

【在 j*****n 的大作中提到】
: not sure for mysql, but for MSSQL, if you specify a primary key, it will
: automatically create a clustered index for you.
: anyway, indexing is different thing with your PK...
: get your knowledge updated by read some database fundamental books please.

j*****n
发帖数: 1781
5
en, maybe you right, I just suppose that lz's table has no PK and indexes
yet.
btw, you can specify do not create clustered index for PK by default. it was
critical issue for MSSQL 6.5 when creating highly transactional OLTP. e.g.
1,000 inserts/second. it will cause "hotspot" problem when PK with clustered
index.
of course, it is already the history, just mention it for fun. :)
when you see some DB under such scenario, you can say, ha, it was originally
created under 6.5 version!

【在 w*******e 的大作中提到】
: 准确的说是: 如果没clustered Index, 那么it will automatically create a
: clustered index on the PK for you.
: 如果有个clustered index 存在了, 那就是automatically create a non-clustered
: index on that PK for you.

u******u
发帖数: 595
6
For any relational database (Oracle, MS SQL, MySQL, DB2...):
Primary key is a table constraint, it means Unique and NOT NULL.
alter table T add primary key (id); will create a primary key on id column,
in the meantime, it will also creat a uniq index on that id column.
You can create a unique index for id column on table T as below:
create unique index idx_t on t(id);
However, unique index column can be NULL.
Therefore, Unix index doesn't equal to primary key.
Send me email for more database q
1 (共1页)
进入Database版参与讨论
相关主题
问个Index的问题SQL 2000 create index 問題
为什么微软专家给一个4x5的只读小表建64个Index(完全相同的)?请教三个Key的property,
这个cassandra paging的解决方案怎么样? (转载)面试问题How would you improve table insert performance? (give five or more ideas)
create a unique primary key that can be indexed IBM netezza sql为啥RDBMS只用一个Index? (转载)
请教 sql server index问题请问MySQL 可以快速处理table有1亿条数据么?
关于MSSQL, 问几个比较土的问题index请教
被人鄙视了两个列联合作Primary Key,还需要单独建index吗?
SQL 2008 Create Index vs Rebuild Index (Alter Index)Join optimization
相关话题的讨论汇总
话题: index话题: clustered话题: primary话题: pk话题: key