How do I index a database column

Hopefully, I can get answers for each database server.

For an outline of how indexing works check out: How does database indexing work?


以下是SQL92标准,所以大部分使用SQL的RDMBS都应该支持这种标准:

CREATE INDEX [index name] ON [table name] ( [column name] )

Sql Server 2005 gives you the ability to specify a covering index. This is an index that includes data from other columns at the leaf level, so you don't have to go back to the table to get columns that aren't included in the index keys.

create nonclustered index my_idx on my_table (my_col1 asc, my_col2 asc) include (my_col3);

This is invaluable for a query that has my_col3 in the select list, and my_col1 and my_col2 in the where clause.


对于python pytables,索引没有名称,它们绑定到单列:

tables.columns.column_name.createIndex()
链接地址: http://www.djcxy.com/p/39368.html

上一篇: 哪些列通常能够创建好的索引?

下一篇: 如何索引数据库列