Commit 933412cd authored by Julien Muchembled's avatar Julien Muchembled

sqlite: minor optimization

Like commit 243c1a0f
("sqlite: optimize storage of metadata"), the fake changes in test
data are because we don't force upgrade for this optimization.
parent d5afef8e
...@@ -165,7 +165,7 @@ class SQLiteDatabaseManager(DatabaseManager): ...@@ -165,7 +165,7 @@ class SQLiteDatabaseManager(DatabaseManager):
# parameters which affect the persistent data. # parameters which affect the persistent data.
schema_dict['config'] = """CREATE TABLE %s ( schema_dict['config'] = """CREATE TABLE %s (
name TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL PRIMARY KEY,
value TEXT) value TEXT) WITHOUT ROWID
""" """
# The table "pt" stores a partition table. # The table "pt" stores a partition table.
...@@ -173,7 +173,8 @@ class SQLiteDatabaseManager(DatabaseManager): ...@@ -173,7 +173,8 @@ class SQLiteDatabaseManager(DatabaseManager):
partition INTEGER NOT NULL, partition INTEGER NOT NULL,
nid INTEGER NOT NULL, nid INTEGER NOT NULL,
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
PRIMARY KEY (partition, nid)) PRIMARY KEY (partition, nid)
) WITHOUT ROWID
""" """
# The table "trans" stores information on committed transactions. # The table "trans" stores information on committed transactions.
...@@ -234,7 +235,8 @@ class SQLiteDatabaseManager(DatabaseManager): ...@@ -234,7 +235,8 @@ class SQLiteDatabaseManager(DatabaseManager):
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
data_id INTEGER, data_id INTEGER,
value_tid INTEGER, value_tid INTEGER,
PRIMARY KEY (tid, oid)) PRIMARY KEY (tid, oid)
) WITHOUT ROWID
""" """
if self.nonempty('config') is None: if self.nonempty('config') is None:
......
BEGIN TRANSACTION; BEGIN TRANSACTION;
CREATE TABLE config ( CREATE TABLE config (
name TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL PRIMARY KEY,
value TEXT); value TEXT) WITHOUT ROWID
;
INSERT INTO "config" VALUES('name','testStorageUpgrade'); INSERT INTO "config" VALUES('name','testStorageUpgrade');
INSERT INTO "config" VALUES('nid','1'); INSERT INTO "config" VALUES('nid','1');
INSERT INTO "config" VALUES('partitions','3'); INSERT INTO "config" VALUES('partitions','3');
...@@ -38,7 +39,9 @@ CREATE TABLE tobj ( ...@@ -38,7 +39,9 @@ CREATE TABLE tobj (
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
data_id INTEGER, data_id INTEGER,
value_tid INTEGER, value_tid INTEGER,
PRIMARY KEY (tid, oid)); PRIMARY KEY (tid, oid)
) WITHOUT ROWID
;
CREATE TABLE trans ( CREATE TABLE trans (
partition INTEGER NOT NULL, partition INTEGER NOT NULL,
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
......
BEGIN TRANSACTION; BEGIN TRANSACTION;
CREATE TABLE config ( CREATE TABLE config (
name TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL PRIMARY KEY,
value TEXT); value TEXT) WITHOUT ROWID
;
INSERT INTO "config" VALUES('name','testStorageUpgrade'); INSERT INTO "config" VALUES('name','testStorageUpgrade');
INSERT INTO "config" VALUES('nid','2'); INSERT INTO "config" VALUES('nid','2');
INSERT INTO "config" VALUES('partitions','3'); INSERT INTO "config" VALUES('partitions','3');
...@@ -38,7 +39,9 @@ CREATE TABLE tobj ( ...@@ -38,7 +39,9 @@ CREATE TABLE tobj (
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
data_id INTEGER, data_id INTEGER,
value_tid INTEGER, value_tid INTEGER,
PRIMARY KEY (tid, oid)); PRIMARY KEY (tid, oid)
) WITHOUT ROWID
;
CREATE TABLE trans ( CREATE TABLE trans (
partition INTEGER NOT NULL, partition INTEGER NOT NULL,
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
......
BEGIN TRANSACTION; BEGIN TRANSACTION;
CREATE TABLE config ( CREATE TABLE config (
name TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL PRIMARY KEY,
value TEXT); value TEXT) WITHOUT ROWID
;
INSERT INTO "config" VALUES('name','testStorageUpgrade'); INSERT INTO "config" VALUES('name','testStorageUpgrade');
INSERT INTO "config" VALUES('nid','3'); INSERT INTO "config" VALUES('nid','3');
INSERT INTO "config" VALUES('partitions','3'); INSERT INTO "config" VALUES('partitions','3');
...@@ -36,7 +37,9 @@ CREATE TABLE tobj ( ...@@ -36,7 +37,9 @@ CREATE TABLE tobj (
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
data_id INTEGER, data_id INTEGER,
value_tid INTEGER, value_tid INTEGER,
PRIMARY KEY (tid, oid)); PRIMARY KEY (tid, oid)
) WITHOUT ROWID
;
CREATE TABLE trans ( CREATE TABLE trans (
partition INTEGER NOT NULL, partition INTEGER NOT NULL,
tid INTEGER NOT NULL, tid INTEGER NOT NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment