{"push_id":1715855661,"size":1,"distinct_size":1,"ref":"refs/heads/REL9_3_STABLE","head":"35ac926bfb8d0926f760abab1afe074aa7595210","before":"062824edd953a5a07fae7400267502d19a8f7bbf","commits":[{"sha":"35ac926bfb8d0926f760abab1afe074aa7595210","author":{"name":"Tom Lane","email":"9ca635a44fdf5aa326758d8d245579b9ae84653c@sss.pgh.pa.us"},"message":"Improve performance of timezone loading, especially pg_timezone_names view.\n\ntzparse() would attempt to load the \"posixrules\" timezone database file on\neach call.  That might seem like it would only be an issue when selecting a\nPOSIX-style zone name rather than a zone defined in the timezone database,\nbut it turns out that each zone definition file contains a POSIX-style zone\nstring and tzload() will call tzparse() to parse that.  Thus, when scanning\nthe whole timezone file tree as we do in the pg_timezone_names view,\n\"posixrules\" was read repetitively for each zone definition file.  Fix\nthat by caching the file on first use within any given process.  (We cache\nother zone definitions for the life of the process, so there seems little\nreason not to cache this one as well.)  This probably won't help much in\nprocesses that never run pg_timezone_names, but even one additional SET\nof the timezone GUC would come out ahead.\n\nAn even worse problem for pg_timezone_names is that pg_open_tzfile()\nhas an inefficient way of identifying the canonical case of a zone name:\nit basically re-descends the directory tree to the zone file.  That's not\nawful for an individual \"SET timezone\" operation, but it's pretty horrid\nwhen we're inspecting every zone in the database.  And it's pointless too\nbecause we already know the canonical spelling, having just read it from\nthe filesystem.  Fix by teaching pg_open_tzfile() to avoid the directory\nsearch if it's not asked for the canonical name, and backfilling the\nproper result in pg_tzenumerate_next().\n\nIn combination these changes seem to make the pg_timezone_names view\nabout 3x faster to read, for me.  Since a scan of pg_timezone_names\nhas up to now been one of the slowest queries in the regression tests,\nthis should help some little bit for buildfarm cycle times.\n\nBack-patch to all supported branches, not so much because it's likely\nthat users will care much about the view's performance as because\ntracking changes in the upstream IANA timezone code is really painful\nif we don't keep all the branches in sync.\n\nDiscussion: https://postgr.es/m/27962.1493671706@sss.pgh.pa.us","distinct":true,"url":"https://api.github.com/repos/postgres/postgres/commits/35ac926bfb8d0926f760abab1afe074aa7595210"}]}
{"actor":{"display_login":"postgres-mirror"}}