无ROWID优化（The WITHOUT ROWID Optimization）

+关注继续查看

1.1 语法

CREATE TABLE IF NOT EXISTS wordcount(
  word TEXT PRIMARY KEY,
  cnt INTEGER
) WITHOUT ROWID;

WITHOUT rowid  withoutrowid  WIThOut rOwId .她们代表一个意思。

2.0 与携带Rowid表不同之处

WITHOUT ROWID是一个优化选项。她没有提供任何新的特性（capablilities.操作携带ROWID表和操作不携带ROWID的表，使用的都是相同的语法。唯一的优点是节省磁盘空间，并且比普通的表快一些。

1.指定了WITHOUT ROWID的表必须指定PRIMARYKEY, 否则建表失败

2指定了WITHOUT ROWID的表不能够指定INTEGERPRIMARY KEYIn an ordinary table, "INTEGER PRIMARY KEY" means that thecolumn is an alias for the rowid. But since there is no rowid in a WITHOUTROWID table, that special meaning no longer applies. An "INTEGER PRIMARYKEY" column in a WITHOUT ROWID table works like an "INT PRIMARYKEY" column in an ordinary table: It is a PRIMARY KEY that has integeraffinity.

本文转自fengyuzaitu 51CTO博客，原文链接：http://blog.51cto.com/fengyuzaitu/1950368，如需转载请自行联系原作者

1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause
38 0
Oracle-12：伪列rowid和rownum
------------吾亦无他,唯手熟尔，谦卑若愚，好学若饥-------------       伪列：不真实存储在真表中，但是我们可以查询到不能对伪列进行增删改操作！   分页可以用rownum来分！！！！！！！（因为oracle中没有limit）   放一份数据库脚本，...
852 0
Principles and Optimization of 5 PostgreSQL Indexes (btree,hash,gin,gist,and brin)
What are the different indexes of PostgreSQL for? How can we optimize our database with these indexes?
2480 0
+关注