Re: More schema queries - Mailing list pgsql-hackers

From Tom Lane
Subject Re: More schema queries
Date
Msg-id 21319.1021674229@sss.pgh.pa.us
Whole thread Raw
In response to More schema queries  ("Dave Page" <dpage@vale-housing.co.uk>)
List pgsql-hackers
"Dave Page" <dpage@vale-housing.co.uk> writes:
> helpdesk=# select relnamespace, relname from pg_class where relname like
> 'pg_%';

>  relnamespace |             relname
> --------------+---------------------------------
> ...
>          2200 | pg_user
>          2200 | pg_rules
>          2200 | pg_views
>          2200 | pg_tables
>          2200 | pg_indexes
>          2200 | pg_stats
>          2200 | pg_stat_all_tables
>          2200 | pg_stat_sys_tables

Bizarre.  It's not that way here.  Would you mind updating to CVS tip,
rebuilding, and seeing if you can duplicate that?  Also, make sure
you're using the right initdb script ...


> ... One of the tests is to
> figure out if one of the base datasources in the query is a view -
> currently this is easy, but in 7.3 we could have a table & a view with
> the same name in different schemas, hence by using the path we can
> figure out what object we're actually using.

Actually, I'd venture that you do *not* want to do namespace search
resolution for yourself; have you thought about how messy the SQL query
would be?  The new datatypes regclass, etc are intended to handle it
for you.  For example

select 'foo'::regclass::oid;    -- get OID of table foo in search path

select 'foo.bar'::regclass::oid;  -- get OID of table foo.bar

select relkind from pg_class where oid = 'foo'::regclass; -- is foo a view?

> Incidently if you're interested at the moment, you may remember that in
> 7.2 beta there was a problem with slow startup under Cygwin which was
> down to a few seconds by release... The last 2 snapshots I've run take
> well over a minute for postmaster startup on a P3M 1.13GHz/512Mb under
> little load. There is virtually no disk activity during this time.

Curious.  I have not noticed much of any change in postmaster startup
time on Unix.  Can you run a profile or something to see where the
time is going?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: +AFs-HACKERS+AF0- More schema queries
Next
From: "Dave Page"
Date:
Subject: Re: More schema queries