any wait event for a commit in sync replication?

2023-01-30 Thread qihua wu
We are using sync replication, if a session runs an insert, and then commit, the client is actually waiting for commit to complete, but looks like this wait doesn't show in pg_stat_activity. In one session I inserted a row (auto commit), it hangs there. example=# insert into test_timteout select

Re: How is timeout implemented in postgresql?

2023-01-30 Thread David G. Johnston
On Mon, Jan 30, 2023 at 6:36 PM qihua wu wrote: > I tried to find out how timeout, such as statement_timeout, works in > source code, But there are so many places it appears in the code, anybody > could show me some clue about where is the entry point for timeout > implementation? >

How is timeout implemented in postgresql?

2023-01-30 Thread qihua wu
I tried to find out how timeout, such as statement_timeout, works in source code, But there are so many places it appears in the code, anybody could show me some clue about where is the entry point for timeout implementation?

Re: Sequence vs UUID

2023-01-30 Thread Ron
And populate that column with UUIDs generated by the gen_random_uuid() function. (Requires v13.) On 1/30/23 13:46, Adrian Klaver wrote: On 1/30/23 11:43, veem v wrote: Thank You So much for the details. I am a bit new to postgres. And these test results I picked were from a dev system. If I

Re: Sequence vs UUID

2023-01-30 Thread Adrian Klaver
On 1/30/23 11:43, veem v wrote: Thank You So much for the details. I am a bit new to postgres. And these test results I picked were from a dev system. If I understand it correctly, do you mean these settings(usage of C locale or "native" 16-byte uuid) which you mentioned should be there in a

Re: Sequence vs UUID

2023-01-30 Thread veem v
Thank You So much for the details. I am a bit new to postgres. And these test results I picked were from a dev system. If I understand it correctly, do you mean these settings(usage of C locale or "native" 16-byte uuid) which you mentioned should be there in a production system and thus we should

Re: How could I elog the tupleTableSlot to the fronted terminal?

2023-01-30 Thread Alvaro Herrera
On 2023-Jan-30, jack...@gmail.com wrote: > For example, I use "insert into t values(1)"; and I 'll get a tupleTableSlot, > > And Now I want to get the real data , that's 1, and then use elog() func > to print it. Could you give me some codes to realize that? futhermore, > what If the data type

Re: Sequence vs UUID

2023-01-30 Thread Tom Lane
Dominique Devienne writes: > On Mon, Jan 30, 2023 at 5:11 PM veem v wrote: >> CREATE TABLE test1_UUID ( id bigint,source_id varchar(36) PRIMARY KEY, Name >> varchar(20) ); > Maybe if you used a "native" 16-byte uuid, instead of its textual > serialization with dashes (36 bytes + length

Re: Sequence vs UUID

2023-01-30 Thread Dominique Devienne
On Mon, Jan 30, 2023 at 5:11 PM veem v wrote: > CREATE TABLE test1_UUID ( id bigint,source_id varchar(36) PRIMARY KEY, Name > varchar(20) ); Maybe if you used a "native" 16-byte uuid, instead of its textual serialization with dashes (36 bytes + length overhead), the gap would narrow.

Re: Sequence vs UUID

2023-01-30 Thread veem v
Was trying to test the performance for simple read/write for the bigint vs UUID. What we see is , ~3 times performance degradation while joining on bigint vs UUID columns. Also even just generation of sequence vs bigint itself is degrading by ~3times too. Also even insert performance on same table

How could I elog the tupleTableSlot to the fronted terminal?

2023-01-30 Thread jack...@gmail.com
For example, I use "insert into t values(1)"; and I 'll get a tupleTableSlot, And Now I want to get the real data , that's 1, and then use elog() func to print it. Could you give me some codes to realize that? futhermore, what If the data type is text or other types? What do I need to change?

Re: alter table impact on view

2023-01-30 Thread Marc Millas
A bit sad Thanks.. Le lun. 30 janv. 2023 à 13:53, David Rowley a écrit : > On Tue, 31 Jan 2023 at 01:14, Marc Millas wrote: > > But if I alter table to change a column that is a varchar 20 into a > varchar 21 > > postgres refuse saying that it cannot due to the return rule... using > said

Re: Does statement_timeout apply to commit?

2023-01-30 Thread Laurenz Albe
On Mon, 2023-01-30 at 17:10 +0800, qihua wu wrote: > I have a patroni cluster running in sync mode and at least 2 nodes should be > synced for commit. Now I brought down one node, so only one slave is in sync, > and then write a java program to write the data to primary in autocommit = > false >

Re: How to control pg_catalog results for each users?

2023-01-30 Thread Ron
On 1/30/23 02:41, Laurenz Albe wrote: On Mon, 2023-01-30 at 14:00 +0900, hirose shigeo(廣瀬 繁雄 □SWC○ACT) wrote: all users can get the all of table name , table structure and other information from pg_catalog, which is considered a security problem. The belief that restricting that will improve

Re: alter table impact on view

2023-01-30 Thread David Rowley
On Tue, 31 Jan 2023 at 01:14, Marc Millas wrote: > But if I alter table to change a column that is a varchar 20 into a varchar 21 > postgres refuse saying that it cannot due to the return rule... using said > column > > why ?? as the view is not a materialized object, the impact of the length of

alter table impact on view

2023-01-30 Thread Marc Millas
Hello, to my understanding, if I do alter table rename column, Postgres change the name of the said column, and modify the views using that table so that they keep working (NOT oracle behaviour..) fine. But if I alter table to change a column that is a varchar 20 into a varchar 21 postgres refuse

Re: Sequence vs UUID

2023-01-30 Thread veem v
I have a question, As i understand here, usage wise there are multiple benefits of UUID over sequences like, in case of distributed app where we may not be able to rely on one point generator like sequences, in case of multi master architecture, sharding. If we just look in terms of performance

Does statement_timeout apply to commit?

2023-01-30 Thread qihua wu
I have a patroni cluster running in sync mode and at least 2 nodes should be synced for commit. Now I brought down one node, so only one slave is in sync, and then write a java program to write the data to primary in autocommit = false mode, I set statement_timeout to 10, hopping the jave will

Re: Postgres upgrade 12 - issues with OIDs

2023-01-30 Thread Venkata B Nagothi
Thanks all for the ideas, we have chosen to resolve this using Logical Replication as we cannot use any other methods due to various constraints. Regards, Venkata B N Database Consultant On Mon, Nov 28, 2022 at 11:16 AM David Rowley wrote: > On Mon, 28 Nov 2022 at 12:46, Venkata B Nagothi

Question on Logical Replication

2023-01-30 Thread Venkata B Nagothi
I have got a question on Logical Replication - we are using PostgreSQL version 11. We are operating in a high transaction environment - so, would like to know if disabling and enabling subscription is gonna miss any transactions ? Meaning - if a subscription is disabled and enabled after a few

Re: How to control pg_catalog results for each users?

2023-01-30 Thread Laurenz Albe
On Mon, 2023-01-30 at 14:00 +0900, hirose shigeo(廣瀬 繁雄 □SWC○ACT) wrote: > all users can get the all of table name , table structure and other > information from pg_catalog, which is considered a security problem. The belief that restricting that will improve security goes by the name of