Re: extending relations more efficiently - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: extending relations more efficiently
Date
Msg-id 20120503171124.GB1267@tamriel.snowman.net
Whole thread Raw
In response to Re: extending relations more efficiently  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
Robert,

* Stephen Frost (sfrost@snowman.net) wrote:
> > In all seriousness, this is not a great test case unless you can
> > provide some scripts to make it easy to run it in a reproducible
> > fashion.  Can you?
>
> Yeah, sure, I'll do that.  The PostGIS folks have scripts, but they're
> kind of ugly, tbh..  I'll give you what I used.

Alright, I made it dirt simple.  Get a DB set up, get PostGIS installed
in to it (or not, if you don't really want to..) and then download this:

http://tamriel.snowman.net/~sfrost/testcase.tar.gz
(Note: it's ~3.7G)

It'll untar in to a 'testcase' directory.  If you have PostGIS
instealled already, just run testcase/create_linearwater.sql first, then
run all the other .sql files in there in parallel by passing them to
psql, eg:

for file in tl*.sql; dopsql -d mydb -f $file &
done

It shouldn't take long to see stuff start blocking on that extension
lock, since the table starts out empty.

If you don't want to install PostGIS, just change the
create_linearwater.sql script to have a column at the end named
'the_geom' and nuke the 'AddGeometryColumn' call.  If you run into
trouble getting PG to exhibit the expected behavior, you might try
combining sets of files, like so:

for state in `ls tl_2011_* | cut -f3 -d_ | cut -c1,2 | sort -u`; docat tl_2011_${state}*.sql | psql -d mydb &
done

Which will reduce the number of processes to just the number of states
and territories (eg: 56), while increasing the amount of work each is
doing.
Thanks,
    Stephen

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: "unexpected EOF" messages
Next
From: Josh Berkus
Date:
Subject: Re: Advisory locks seem rather broken