Unix Technical Forum

Accessing pg_timezone_names system view

This is a discussion on Accessing pg_timezone_names system view within the Pgsql General forums, part of the PostgreSQL category; --> I was wondering if there is any reason that accessing the system view pg_timezone_names is extremely slow relative to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 06:58 PM
Naz Gassiep
 
Posts: n/a
Default Accessing pg_timezone_names system view

I was wondering if there is any reason that accessing the system view
pg_timezone_names is extremely slow relative to other queries. The
following query:

SELECT * FROM pg_timezone_names;

Executes in between 29ms and 32ms on my server. It takes about the same
when I put a

WHERE name = 'some/timezone'

clause in it. To put this into perspective, on the pages that execute
this, it accounts for something like 3/4 of my DB execution time.

Here's a screenshot to show you what I'm talking about:

http://www.mrnaz.com/dbetime.gif

As you can see, the execution of that single fetch dwarfs all other
processing loads. I've run this a few times, and the timings are always
roughly the same. Is there a way for me to speed this up? Would I be
better off loading these into a static table and executing from there?
It seems kinda purpose defeating to do that though. Perhaps this has
been addressed in 8.3 ? I eagerly await.

Regards,
- Naz

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 06:58 PM
Magnus Hagander
 
Posts: n/a
Default Re: Accessing pg_timezone_names system view

On Fri, Aug 17, 2007 at 11:51:52PM +1000, Naz Gassiep wrote:
> I was wondering if there is any reason that accessing the system view
> pg_timezone_names is extremely slow relative to other queries. The
> following query:
>
> SELECT * FROM pg_timezone_names;
>
> Executes in between 29ms and 32ms on my server. It takes about the same
> when I put a
>
> WHERE name = 'some/timezone'
>
> clause in it. To put this into perspective, on the pages that execute
> this, it accounts for something like 3/4 of my DB execution time.


This view is backed by a set returning function that will enumerate all the
files in the timezone directory. The WHERE clause doesn't apply until after
the function has already traversed all files.

> As you can see, the execution of that single fetch dwarfs all other
> processing loads. I've run this a few times, and the timings are always
> roughly the same. Is there a way for me to speed this up? Would I be
> better off loading these into a static table and executing from there?


Yes, much better if it's something you're querying regularly.

//Magnus

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:09 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com