From: | vinny <vinny(at)xs4all(dot)nl> |
---|---|
To: | gmb <gmbouwer(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: optimize pg_tables query ( text vs varchar ) ...why ? |
Date: | 2017-08-16 14:12:05 |
Message-ID: | f433ae4edce48fe2e87682d9df54544d@xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2017-08-16 14:41, gmb wrote:
> Hi
> For DDL purposes we make significant use of pg_catalog tables/views.
> Were investigating performance issues in a typical function:
>
> CREATE FUNCTION tableexists( s TEXT , t TEXT ) returns boolean as
> $$
> SELECT count(tablename) = 1 FROM pg_tables WHERE schemaname=$1 and
> tablename=$2;
> $$
> language sql
>
> When change the params of above function to VARCHAR (instead of TEXT),
> performance improved dramatically.
> We then changed params to NAME ( as per pg_tables column type ) , but
> the
> performance stayed more or less the same.
>
> Can somebody explain this to me ? Is there a better way in which to
> handle
> these ?
> (This will be implemented on most object in the catalog e.g. columns,
> sequences, functions, etc )
>
> Regards
> gmb
>
>
>
> --
> View this message in context:
> http://www.postgresql-archive.org/optimize-pg-tables-query-text-vs-varchar-why-tp5978592.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
A wild stab in the dark: typecasting?
pg_tables returns 'name' type, not TEXT, so some sort of transformation
has to be done and that takestime.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-08-16 14:36:14 | Re: optimize pg_tables query ( text vs varchar ) ...why ? |
Previous Message | Tom Lane | 2017-08-16 14:02:21 | Re: pg_column_size strange result... |