From: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com> |
---|---|
To: | Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | pg_next_dst_boundary optimization |
Date: | 2007-09-19 11:25:20 |
Message-ID: | 46F10720.5030206@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
While profiling loading a table with timestamp columns with COPY, I
spotted that a lot of time is spent in pg_next_dst_boundary. It scans a
sorted array of time segments to find the one that the given timestamp
falls within. That's slow when the array is big; GB timezone for example
has > 200 segments.
Attached is a patch to use binary search instead of linear search. On my
laptop, it reduces the time required to load million rows to this test
table:
CREATE TABLE timestamptable (
id int,
ts1 timestamp,
ts2 timestamp,
ts3 timestamp,
ts4 timestamp
);
from ~16.4s to ~11.9s.
It would be nice to slip this into 8.3...
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
next_dst_boundary_binsrch.patch | text/x-diff | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2007-09-19 13:03:34 | Re: pg_next_dst_boundary optimization |
Previous Message | Magnus Hagander | 2007-09-19 11:17:16 | Re: WIP - MSVC build script replacements |