Fossil SCM
Run "analyze" after a rebuild. For small repositories, the time doesn't matter and for large repositories, the effect on the query plans are huge. Push/pull for example will otherwise do a sequential scan of the blob table and joining that with the unclustered table afterwards, when the other way around is several order of magnitudes more efficient.
Commit
80bf94e0f7ea9eb64ad9c35ed61863d73160767e
Parent
2f10a050c694431…
1 file changed
+3
+3
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -614,10 +614,13 @@ | ||
| 614 | 614 | } |
| 615 | 615 | if( activateWal ){ |
| 616 | 616 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | + fossil_print("Analyzing the database... "); fflush(stdout); | |
| 620 | + db_multi_exec("analyze"); | |
| 621 | + fossil_print("done\n"); | |
| 619 | 622 | if( showStats ){ |
| 620 | 623 | static struct { int idx; const char *zLabel; } aStat[] = { |
| 621 | 624 | { CFTYPE_ANY, "Artifacts:" }, |
| 622 | 625 | { CFTYPE_MANIFEST, "Manifests:" }, |
| 623 | 626 | { CFTYPE_CLUSTER, "Clusters:" }, |
| 624 | 627 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -614,10 +614,13 @@ | |
| 614 | } |
| 615 | if( activateWal ){ |
| 616 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 617 | } |
| 618 | } |
| 619 | if( showStats ){ |
| 620 | static struct { int idx; const char *zLabel; } aStat[] = { |
| 621 | { CFTYPE_ANY, "Artifacts:" }, |
| 622 | { CFTYPE_MANIFEST, "Manifests:" }, |
| 623 | { CFTYPE_CLUSTER, "Clusters:" }, |
| 624 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -614,10 +614,13 @@ | |
| 614 | } |
| 615 | if( activateWal ){ |
| 616 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 617 | } |
| 618 | } |
| 619 | fossil_print("Analyzing the database... "); fflush(stdout); |
| 620 | db_multi_exec("analyze"); |
| 621 | fossil_print("done\n"); |
| 622 | if( showStats ){ |
| 623 | static struct { int idx; const char *zLabel; } aStat[] = { |
| 624 | { CFTYPE_ANY, "Artifacts:" }, |
| 625 | { CFTYPE_MANIFEST, "Manifests:" }, |
| 626 | { CFTYPE_CLUSTER, "Clusters:" }, |
| 627 |