Обсуждение: Reduce size of $PGDATA for "demo cdrom"?
Hi all -
We've got a product built on FreeBSD and PostgreSQL 7.4.2 that
I've had to fit onto an installable CDROM tradeshows and customer demos.
This is the only way I've found to ensure an easy to re-install option
for the non-technical folks at the tradeshows should they corrupt the box
itself. This part all works fine.
However, I've only got 700mb to work with and the bootable CDROM takes a
chunk of that as does the rest of our app.
Doing a pg_dumpall of the database results in a 369Kb file.
However, $PGDATA is around 60mb.
root@tradeshow:/local/pgsql/data% du -hcs base/* pg_xlog/*
4.4M base/1
4.4M base/17141
4.4M base/17144
4.4M base/17145
6.6M base/17146
5.4M base/17147
16M pg_xlog/0000000000000006
16M pg_xlog/0000000000000007
62M total
My question is what's the best way to trim that down? I realize I could
remove it completely and have my install script do an initdb, etc, but if
there's anyway to keep the installation intact to begin with I'd prefer
that.
Is there any other way to trim the size of those files? Maybe dump
everything out, "clean up", then restore it. Then immediately burn things
to CD? Or if there are postgresql.conf options I can set to not keep WAL
logs, etc around that would work too since this is just for tradeshows...
Thanks all!
-philip
On Wed, 2005-04-27 at 10:10, Philip Hallstrom wrote: > Hi all - > We've got a product built on FreeBSD and PostgreSQL 7.4.2 that > I've had to fit onto an installable CDROM tradeshows and customer demos. > This is the only way I've found to ensure an easy to re-install option > for the non-technical folks at the tradeshows should they corrupt the box > itself. This part all works fine. > > However, I've only got 700mb to work with and the bootable CDROM takes a > chunk of that as does the rest of our app. > > Doing a pg_dumpall of the database results in a 369Kb file. > > However, $PGDATA is around 60mb. > > root@tradeshow:/local/pgsql/data% du -hcs base/* pg_xlog/* > 4.4M base/1 > 4.4M base/17141 > 4.4M base/17144 > 4.4M base/17145 > 6.6M base/17146 > 5.4M base/17147 > 16M pg_xlog/0000000000000006 > 16M pg_xlog/0000000000000007 > 62M total > > > My question is what's the best way to trim that down? I realize I could > remove it completely and have my install script do an initdb, etc, but if > there's anyway to keep the installation intact to begin with I'd prefer > that. My first recommendation would be to put everything into one database. it looks like you've got 6 databases. If you've still got the template0 database, you can probably get rid of that one as well. If you're not going to need to create any new databases you can maybe drop template1 too. psql somedbotherthanthetemplateones update pg_database set datistemplate=false; drop database template0; drop database template1; Set the checkpoint_segments = 1 in the postgresql.conf file. Not sure how much that will help, but it should keep the checkpoint files at 16 meg. Lastly, put those other four or databases into separate schemas in one database.
On Wed, Apr 27, 2005 at 10:23:19 -0500, Scott Marlowe <smarlowe@g2switchworks.com> wrote: > > My first recommendation would be to put everything into one database. > it looks like you've got 6 databases. If you've still got the template0 > database, you can probably get rid of that one as well. If you're not > going to need to create any new databases you can maybe drop template1 > too. Isn't template0 needed for dumps, since they are relative to template0?
On Wed, 2005-04-27 at 20:44, Bruno Wolff III wrote: > On Wed, Apr 27, 2005 at 10:23:19 -0500, > Scott Marlowe <smarlowe@g2switchworks.com> wrote: > > > > My first recommendation would be to put everything into one database. > > it looks like you've got 6 databases. If you've still got the template0 > > database, you can probably get rid of that one as well. If you're not > > going to need to create any new databases you can maybe drop template1 > > too. > > Isn't template0 needed for dumps, since they are relative to template0? No, it's template1, and you only need it for pg_dumpall. pg_dump should still work. Note that without template1, things like psql -l will fail. But you can still connect to the one database you know the name of.