Re: pg_stat_statements

2022-01-11 Thread Julien Rouhaud
Hi, On Tue, Jan 11, 2022 at 03:04:14PM +, Dirschel, Steve wrote: > > I'm not sure if this is the correct distribution list for this type of > question but I'll try anyways. We have an app that uses multiple schemas. > It will do a set schema 'schema_name' and execute queries. The queries > e

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Adrian Klaver
On 1/11/22 01:34, Dominique Devienne wrote: On Mon, Jan 10, 2022 at 11:13 PM Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: I go into use cases in my previous message, send a minute ago. In your OP the error occurred here: DROP OWNED BY "Epos-PNS (a73e1fbdcc5b4460ba55703a0

Re: Template for schema? (as opposed to databases)

2022-01-11 Thread David G. Johnston
On Tue, Jan 11, 2022 at 9:42 AM Dominique Devienne wrote: > On Tue, Jan 11, 2022 at 5:30 PM David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Tuesday, January 11, 2022, Dominique Devienne >> wrote: >>> >>> This means the template-schema name is part of the DDL for the schema, >>>

Re: Template for schema? (as opposed to databases)

2022-01-11 Thread Dominique Devienne
On Tue, Jan 11, 2022 at 5:38 PM Francisco Olarte wrote: > On Tue, 11 Jan 2022 at 17:10, Dominique Devienne > wrote: > ... > > Creating the first two "fixed" schemas is fast enough. 300ms, including > populating the 2nd with a bunch of rows. > > But creating the 3rd kind, which will be done many

Re: Template for schema? (as opposed to databases)

2022-01-11 Thread Dominique Devienne
On Tue, Jan 11, 2022 at 5:38 PM Francisco Olarte wrote: > > Right now, that implies quite a few round-trips to the server, about > 1'100, but on the LAN with sub-ms latency; > > How much sub-ms? I mean, I have 0.74 pings to my router, but this > would be .82s, a good chunk of your quoted 2-3s, (a

Re: Template for schema? (as opposed to databases)

2022-01-11 Thread Dominique Devienne
On Tue, Jan 11, 2022 at 5:30 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tuesday, January 11, 2022, Dominique Devienne > wrote: >> >> This means the template-schema name is part of the DDL for the schema, >> and a clone would need to use its own search-path, not the original. >

Re: Template for schema? (as opposed to databases)

2022-01-11 Thread Francisco Olarte
Hi Dominique: On Tue, 11 Jan 2022 at 17:10, Dominique Devienne wrote: ... > Creating the first two "fixed" schemas is fast enough. 300ms, including > populating the 2nd with a bunch of rows. > But creating the 3rd kind, which will be done many times, is not so fast, at > 2.5 - 3s, which may see

Re: Template for schema? (as opposed to databases)

2022-01-11 Thread David G. Johnston
On Tuesday, January 11, 2022, Dominique Devienne wrote: > > This means the template-schema name is part of the DDL for the schema, and > a clone would need to use its own search-path, not the original. > This is your major limitation. You are required to create new objects from code and cannot l

Template for schema? (as opposed to databases)

2022-01-11 Thread Dominique Devienne
Hi, As many have surmised from my previous messages, I need to create a set of schemas, where two schemas as smallish and distincts, with an arbitrary number of additional schemas (of a 3rd kind), which is "largish" (244 tables, 4'000+ columns, 1'300+ relations). That's why I say / write that I h

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread Pavel Stehule
út 11. 1. 2022 v 16:51 odesílatel napsal: > ‌Hi, Thank you for pointing this part of the documentation. > It's actually works with EXECUTE 'INSERT INTO my_table VALUES((random() * > 100)::INT);'; INSTEAD OF INSERT INTO my_table VALUES((random() * 100)::INT); > And it's possible to suppose that th

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread benj . dev
‌Hi, Thank you for pointing this part of the documentation. It's actually works with EXECUTE 'INSERT INTO my_table VALUES((random() * 100)::INT);'; INSTEAD OF INSERT INTO my_table VALUES((random() * 100)::INT); And it's possible to suppose that the test_search_path_v2 worked before because of the

Re: Folding of case of identifiers

2022-01-11 Thread Tom Lane
Niels Jespersen writes: > According to https://www.postgresql.org/docs/current/sql-syntax-lexical.html, > "Key words and unquoted identifiers are case insensitive." And "SQL > identifiers and key words must begin with a letter (a-z, but also letters > with diacritical marks and non-Latin letter

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread Tom Lane
benj@laposte.net writes: > -- Executing each row on differents transactions but in the same session > /*Session A - Transaction 1*/ SELECT * FROM test_search_path_v1(true);  -- => > OK takes table from pg_temp (no existing table in public) > /*Session A - Transaction 2*/ SELECT * FROM test_sea

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Tom Lane
Dominique Devienne writes: > OK :). But it does matter. those locks. Especially if DROP'ing a DB (as you > suggest) requires just the same. But it doesn't. regards, tom lane

pg_stat_statements

2022-01-11 Thread Dirschel, Steve
Hello, I'm not sure if this is the correct distribution list for this type of question but I'll try anyways. We have an app that uses multiple schemas. It will do a set schema 'schema_name' and execute queries. The queries executed are the same regardless of the schema the connection set. I

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread David G. Johnston
On Tuesday, January 11, 2022, wrote: > > SHOW search_path -- => "$user", public; > DROP TABLE IF EXISTS my_table; > -- Executing each row on differents transactions but in the same session > /*Session A - Transaction 1*/ SELECT * FROM test_search_path_v1(true); -- > => OK takes table from pg_tem

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Dominique Devienne
On Tue, Jan 11, 2022 at 12:47 PM Wolfgang Walther wrote: > Dominique Devienne: > > I wish for DB-specific ROLEs BTW... > > Same here. That would be so useful. > In fact, in my case, I also want something even narrower than that, which are SCHEMA specific ROLEs. ROLEs tied to a given schema, impl

Re: plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread Pavel Stehule
út 11. 1. 2022 v 10:54 odesílatel napsal: > Hi, > > I would like to submit a problem (bug ?) that I encountered while handling > temporary tables in plpgsql functions. > > First, if I create a TABLE and a TEMP TABLE with the same name, and I > request without specified the schema, the temporary t

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Francisco Olarte
Dominique: On Tue, 11 Jan 2022 at 11:57, Dominique Devienne wrote: > On Tue, Jan 11, 2022 at 11:05 AM Francisco Olarte > wrote: >> Not going to enter into the lock situation but... > OK :). But it does matter. those locks. Especially if DROP'ing a DB (as you > suggest) requires just the same.

Folding of case of identifiers

2022-01-11 Thread Niels Jespersen
Hello all According to https://www.postgresql.org/docs/current/sql-syntax-lexical.html, "Key words and unquoted identifiers are case insensitive." And "SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Wolfgang Walther
Dominique Devienne: I wish for DB-specific ROLEs BTW... Same here. That would be so useful.

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Dominique Devienne
On Tue, Jan 11, 2022 at 11:05 AM Francisco Olarte wrote: > Dominique: > Not going to enter into the lock situation but... > OK :). But it does matter. those locks. Especially if DROP'ing a DB (as you suggest) requires just the same. > On Tue, 11 Jan 2022 at 10:24, Dominique Devienne > wrote:

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Francisco Olarte
Dominique: Not going to enter into the lock situation but... On Tue, 11 Jan 2022 at 10:24, Dominique Devienne wrote: ... > I need for unit testing purposes to be able to support multiple (2+N schemas) > "instances". > Each instance (of 2+N schemas) is owned by a separate ROLE, created for that

plpgsql function problem whith creating temp table - not correctly using search_path ?

2022-01-11 Thread benj . dev
Hi, I would like to submit a problem (bug ?) that I encountered while handling temporary tables in plpgsql functions. First, if I create a TABLE and a TEMP TABLE with the same name, and I request without specified the schema, the temporary table is used. -- SHOW search_path; -- => "$user", pub

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Dominique Devienne
On Mon, Jan 10, 2022 at 11:13 PM Adrian Klaver wrote: > On 1/10/22 13:58, Dominique Devienne wrote: > > > Given that Tom mentions max_locks_per_transaction can be safely > increased, > > and given the stats I mentioned in this thread, what would a > > "reasonable" max_locks_per_transaction > > be

Re: DROP OWNED BY fails with #53200: ERROR: out of shared memory

2022-01-11 Thread Dominique Devienne
On Mon, Jan 10, 2022 at 10:40 PM Alvaro Herrera wrote: > On 2022-Jan-10, Dominique Devienne wrote: > > > Btw, is there a catalog accurately count a schémas relations from > the catalog? > > pg_class > ddevienne=> select relnamespace::regnamespace::text, count(*) from pg_class where relnamespace: