Re: [GENERAL] optimize pg_tables query ( text vs varchar ) ...why ?

2017-08-16 Thread gmb
Thanks for this , Tom -- View this message in context: http://www.postgresql-archive.org/optimize-pg-tables-query-text-vs-varchar-why-tp5978592p5978654.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list

Re: [GENERAL] optimize pg_tables query ( text vs varchar ) ...why ?

2017-08-16 Thread Tom Lane
gmb writes: > Tom Lane-2 wrote >> Personally I'd have left the function parameters as text and inserted >> explicit coercions: > Just out of curiosity , is there a reason why this will be you preference ? Well, if the rest of your code thinks that table names are of type

Re: [GENERAL] optimize pg_tables query ( text vs varchar ) ...why ?

2017-08-16 Thread gmb
Thanks for taking the time, Tom. Tom Lane-2 wrote > After that, the planner has to implement the query, and the problem > is that the available indexes are on "schemaname" not "schemaname::text", > and they can only use the name = name operator anyway. Did some digging earlier, and found

Re: [GENERAL] optimize pg_tables query ( text vs varchar ) ...why ?

2017-08-16 Thread Tom Lane
gmb writes: > 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), >

Re: [GENERAL] optimize pg_tables query ( text vs varchar ) ...why ?

2017-08-16 Thread vinny
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