Parcourir la source

[1756] Add an index on (rname, rdtype) to records SQLite3 table

The dbutil upgrade tool still has to be checked if it needs an update.
Mukund Sivaraman il y a 12 ans
Parent
commit
388434f8a4

+ 1 - 0
src/lib/datasrc/sqlite3_accessor.cc

@@ -358,6 +358,7 @@ const char* const SCHEMA_LIST[] = {
     // defining a separate index for rdtype only doesn't work either; SQLite3
     // would then create a temporary B-tree for "ORDER BY").
     "CREATE INDEX records_bytype_and_rname ON records (rdtype, rname)",
+    "CREATE INDEX records_byrname_and_rdtype ON records (rname, rdtype)",
     "CREATE TABLE nsec3 (id INTEGER PRIMARY KEY, zone_id INTEGER NOT NULL, "
         "hash TEXT NOT NULL COLLATE NOCASE, "
         "owner TEXT NOT NULL COLLATE NOCASE, "

+ 2 - 0
src/lib/python/isc/datasrc/sqlite3_ds.py

@@ -73,6 +73,8 @@ def create(cur):
         cur.execute("CREATE INDEX records_byrname ON records (rname)")
         cur.execute("""CREATE INDEX records_bytype_and_rname ON records
                        (rdtype, rname)""")
+        cur.execute("""CREATE INDEX records_byrname_and_rdtype ON records
+                       (rname, rdtype)""")
         cur.execute("""CREATE TABLE nsec3 (id INTEGER PRIMARY KEY,
                     zone_id INTEGER NOT NULL,
                     hash TEXT NOT NULL COLLATE NOCASE,