Page MenuHomeSoftware Heritage

db-git-repo-meta.sh
No OneTemporary

db-git-repo-meta.sh

#!/usr/bin/env bash
# Use: $0 <DB-name>
# will compute the number of revision, directory, content from db respectively.
DB=$1
count() {
DB=$1
QUERY=$2
psql -d $1 --command "$QUERY;" | tail -3 | head -1
}
NB_CONTENTS=$(count $DB "select count(*) from content;")
NB_DIRECTORIES=$(count $DB "select count(*) from directory;")
NB_DIRECTORY_ENTRIES=$(count $DB "select count(*) from directory_entry;")
NB_REVISIONS=$(count $DB "select count(*) from revision;")
NB_RELEASES=$(count $DB "select count(*) from release;")
NB_PERSONS=$(count $DB "select count(*) from person;")
cat<<EOF
content $NB_CONTENTS
directory $NB_DIRECTORIES
directory_entries $NB_DIRECTORY_ENTRIES
revision $NB_REVISIONS
release $NB_RELEASES
person $NB_PERSONS
EOF

File Metadata

Mime Type
text/x-shellscript
Expires
Fri, Jul 4, 4:24 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3283752

Event Timeline