git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Use column indexes in git-cvsserver where necessary.

From
Shawn Pearce <spearce@spearce.org>
Date
Oct 23, 2006, 05:09 UTC
Message-ID
<20061023050934.GA25018@spearce.org>

Tonight I found a git-cvsserver instance spending a lot of time in disk IO while trying to process operations against a Git repository with >30,000 objects contained in it.

Blowing away my SQLLite database and rebuilding all tables with indexes on the attributes that git-cvsserver frequently runs queries against seems to have resolved the issue quite nicely.

Since the indexes shouldn't hurt performance on small repositories and always helps on larger repositories we should just always create them when creating the revision storage tables.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 git-cvsserver.perl |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 08ad831..8817f8b 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -2118,9 +2118,17 @@ sub new
                 mode       TEXT NOT NULL
             )
         ");
+        $self->{dbh}->do("
+            CREATE INDEX revision_ix1
+            ON revision (name,revision)
+        ");
+        $self->{dbh}->do("
+            CREATE INDEX revision_ix2
+            ON revision (name,commithash)
+        ");
     }
 
-    # Construct the revision table if required
+    # Construct the head table if required
     unless ( $self->{tables}{head} )
     {
         $self->{dbh}->do("
@@ -2134,6 +2142,10 @@ sub new
                 mode       TEXT NOT NULL
             )
         ");
+        $self->{dbh}->do("
+            CREATE INDEX head_ix1
+            ON head (name)
+        ");
     }
 
     # Construct the properties table if required
-- 
1.4.3.g4e51
Next: Martin Langhoff (CatalystIT)
Message 1 of 2 in “Use column indexes in git-cvsserver where necessary.”
  1. Use column indexes in git-cvsserver where necessary.Shawn Pearce, Oct 23, 2006
  2. Martin Langhoff (CatalystIT)Oct 23, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.