From: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com> |
---|---|
To: | Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Split _bt_insertonpg to two functions |
Date: | 2007-02-26 10:13:20 |
Message-ID: | 45E2B2C0.8020103@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Here's a patch that:
Moves the logic to find a page with enough room from _bt_insertonpg to a
new function, _bt_findinsertloc. It makes the code more readable, and
simplifies the forthcoming Grouped Index Tuples patch.
Also, the insert location within page used to be calculated twice for
unique indexes, once in _bt_checkunique and second time in
_bt_insertonpg. That's a waste of cycles, and this patch fixes that.
I couldn't measure a difference with pgbench, but this micro-benchmark
shows it:
> psql postgres -c "CREATE TABLE inserttest (i int PRIMARY KEY);"
> psql postgres -c "TRUNCATE inserttest; checkpoint;"; sync
> time ~/pgsql.cvshead/bin/psql postgres -c "TRUNCATE inserttest;
INSERT INTO inserttest SELECT a FROM generate_series(1,1000000) a;"
Without patch: real 0m7.260s
With patch: real 0m6.963s
On my laptop, fsync=off, full_page_writes=off, checkpoint_segments = 10,
to remove any other variables.
It's not a huge difference, but it's worth having, and performance
wasn't the main motivation of the patch anyway.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
findinsertloc_refactor.patch | text/x-patch | 18.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | NikhilS | 2007-02-26 13:36:37 | Re: Recalculating OldestXmin in a long-running vacuum |
Previous Message | Matteo Beccati | 2007-02-26 08:42:00 | Re: Small patch to compile on IRIX 6.5 with gcc |