Fossil SCM

Get a 10x speedup on long annotations by indexing a field in the temporary "ancestor" table.

drh 2013-09-17 16:08 trunk
Commit 1c40de184393c829e505d8e780c7ee961582fd11
1 file changed +1 -1
--- src/descendants.c
+++ src/descendants.c
@@ -203,11 +203,11 @@
203203
void compute_direct_ancestors(int rid, int N){
204204
Stmt ins;
205205
Stmt q;
206206
int gen = 0;
207207
db_multi_exec(
208
- "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER,"
208
+ "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER UNIQUE NOT NULL,"
209209
" generation INTEGER PRIMARY KEY);"
210210
"DELETE FROM ancestor;"
211211
"INSERT INTO ancestor VALUES(%d, 0);", rid
212212
);
213213
db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
214214
--- src/descendants.c
+++ src/descendants.c
@@ -203,11 +203,11 @@
203 void compute_direct_ancestors(int rid, int N){
204 Stmt ins;
205 Stmt q;
206 int gen = 0;
207 db_multi_exec(
208 "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER,"
209 " generation INTEGER PRIMARY KEY);"
210 "DELETE FROM ancestor;"
211 "INSERT INTO ancestor VALUES(%d, 0);", rid
212 );
213 db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
214
--- src/descendants.c
+++ src/descendants.c
@@ -203,11 +203,11 @@
203 void compute_direct_ancestors(int rid, int N){
204 Stmt ins;
205 Stmt q;
206 int gen = 0;
207 db_multi_exec(
208 "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER UNIQUE NOT NULL,"
209 " generation INTEGER PRIMARY KEY);"
210 "DELETE FROM ancestor;"
211 "INSERT INTO ancestor VALUES(%d, 0);", rid
212 );
213 db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
214

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button