Skip site navigation (1) Skip section navigation (2)

Re: pg_next_dst_boundary optimization

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_next_dst_boundary optimization
Date: 2007-09-19 13:03:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Heikki Linnakangas wrote:
> 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. 

Digging deeper into this, that function is essentially the same as the
first part of localsub [1], which should also be changed to use binary
search. In fact, that's exactly what localsub does in the most recent
version of the tz library.

Has anyone looked what other changes there's been to the code in tz
library? Which version of tz is our code based on?

[1] Tom's post introducing pg_next_dst_boundary:,

  Heikki Linnakangas

In response to


pgsql-patches by date

Next:From: Guillaume SmetDate: 2007-09-19 15:00:24
Subject: Re: like/ilike improvements
Previous:From: Heikki LinnakangasDate: 2007-09-19 11:25:20
Subject: pg_next_dst_boundary optimization

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group