Sujee Maniyam wrote:
> Hi guys
> I am keeping a database dump in git.
>     uncompressed db.sql    - size : 41M
>     compressed  db.sql.gz  - size : 4M
> I am trying to figure out which format to use.   Gzippd version is
> smaller, but  I am not sure if git can save only the deltas thus
> keeping the repository lean.  Text format is big, but the deltas are
> easier to figure out and ongoing deltas can keep the repository small.

I am doing this with postgresql plaintext database dump files. It
very well for having a versioned backup with commit messages from
you can restore to any old revision.

$ cat
pg_dump --format=p -c -U postgres mydatabase --file=mydatabase.sql


$ cat
psql -U postgres -d mydatabase -f mydatabase.sql

The 41mb commit will be a one-time cost, and as mentioned elsewhere in
the thread, git compresses. git does use the diff when committing new
revisions, so the size of each diff grows with each changed row. The
can be large if you update a whole column, for example.

You didn't mention which database you are using, but for postgresql,
the table data COPY statement row are not ordered. In practice the
diff is usually sensible, but occasionally you will see unaltered or
slightly changed rows moving up or down in the COPY row order.

Git will also highlight trailing whitespace in a database dump file. I
prefer not to alter the database dump format at all for reliability.

Database dump files are not suited to branching and merging. I find
they are versioned snapshots only, and very useful for that reason

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to