Re: How to improve the performance of my SQL query?

2023-07-26 Thread David Rowley
On Wed, 26 Jul 2023 at 19:46, gzh wrote: > QUERY PLAN (enable_seqscan=on) > Execution Time: 167183.133 ms > QUERY PLAN (enable_seqscan=off) > Execution Time: 22320.153 ms effective_cache_size and random_page_cost are the settings you should be adjusting to coax the planner into using the

Re: Difference in the tablespace folders on primary and secondary nodes

2023-07-26 Thread Stephen Frost
Greetings, On Wed, Jul 26, 2023 at 21:31 Abhishek Bhola wrote: > Thank you for the very detailed reply. I tried the above method and it > works. I'm still setting up pgBackRest. > > I have one last question if you can answer that too please. > >> A delta restore will only restore those >> files

Re: Difference in the tablespace folders on primary and secondary nodes

2023-07-26 Thread Abhishek Bhola
Hi Stephen Thank you for the very detailed reply. I tried the above method and it works. I'm still setting up pgBackRest. I have one last question if you can answer that too please. > A delta restore will only restore those > files on the replica which are different from what was in the backup

Re: Query on Primary_conninfo

2023-07-26 Thread Michael Paquier
On Wed, Jul 26, 2023 at 05:33:50PM +0530, Praneel Devisetty wrote: > Standy is not picking this change even after a reload. > > Restarting standby is working out, but as PG13 supports reload of > primary_connfino is there a reliable way to achieve this without restarting > standby database.

Re: logging_collector is off, but the logging is opening

2023-07-26 Thread Adrian Klaver
On 7/25/23 14:43, Wen Yi wrote: Hi community, When I use the postgres, I check the log.(I use the -l open the log) As you can see, I type code like this: postgres=# show logging_collector;  logging_collector ---  off (1 row) postgres=# ^C Follow the document, when

Re: Difference in the tablespace folders on primary and secondary nodes

2023-07-26 Thread Stephen Frost
Greetings, * Abhishek Bhola (abhishek.bh...@japannext.co.jp) wrote: > > Basically, this is not a valid way to perform a backup/restore of PG. > > Is it not valid only for PG 15 or even for earlier versions? I have always > referred to this https://www.postgresql.org/docs/8.1/backup-online.html

Query on Primary_conninfo

2023-07-26 Thread Praneel Devisetty
Hi, I have a postgresql cluster running on 13.9.13 and standby has primary_connfino as below host=kabc03-dev01-ins06-pgs54-dbs-asy.int.dev.example.com port=5432 user=pubuser_1 passfile='/home/postgres/.pgpass' application_name=dr_node1 hostname

logging_collector is off, but the logging is opening

2023-07-26 Thread Wen Yi
Hi community, When I use the postgres, I check the log.(I use the -l open the log) As you can see, I type code like this: postgres=# show logging_collector; logging_collector --- off (1 row) postgres=# ^C Follow the document, when logging_collector is off, there's no log

Re: How to check for Overlapping Date Ranges with extra fields in table EXCLUDE constraint?

2023-07-26 Thread Thomas Kellerer
Dominique Devienne schrieb am 26.07.2023 um 11:39: > On Wed, Jul 26, 2023 at 11:26 AM Dionisis Kontominas > wrote: > > Dionisis Kontominas schrieb am 26.07.2023 um 11:00: > > do not want two records to overlap, for the same user, the same role >

Re: How to check for Overlapping Date Ranges with extra fields in table EXCLUDE constraint?

2023-07-26 Thread Dominique Devienne
On Wed, Jul 26, 2023 at 11:26 AM Dionisis Kontominas wrote: > On Wed, 26 Jul 2023 at 11:18, Thomas Kellerer wrote: > >> Dionisis Kontominas schrieb am 26.07.2023 um 11:00: >> > do not want two records to overlap, for the same user, the same role >> > and also when the f_is_deleted is TRUE only.

Re: How to check for Overlapping Date Ranges with extra fields in table EXCLUDE constraint?

2023-07-26 Thread Dionisis Kontominas
Hi Thomas, Thank you very much for your reply and comment. I am trying to avoid writing trigger code to handle this requirement. I will do so and try your suggestion. I believe also that the partial constraint you propose to me should be in the end: ... WHERE (NOT f_is_deleted) as

Re: How to check for Overlapping Date Ranges with extra fields in table EXCLUDE constraint?

2023-07-26 Thread Thomas Kellerer
Dionisis Kontominas schrieb am 26.07.2023 um 11:00: > Hello all, > > In the Subject I mention what I am intending to do. Letme put some context; > this is my table: > > portal_user_role > ( >     f_id INTEGER NOT NULL, >     f_portal_user_id INTEGER NOT NULL, >     f_portal_role_id INTEGER NOT

How to check for Overlapping Date Ranges with extra fields in table EXCLUDE constraint?

2023-07-26 Thread Dionisis Kontominas
Hello all, In the Subject I mention what I am intending to do. Letme put some context; this is my table: portal_user_role ( f_id INTEGER NOT NULL, f_portal_user_id INTEGER NOT NULL, f_portal_role_id INTEGER NOT NULL, f_is_active BOOLEAN NOT NULL, f_is_deleted BOOLEAN NOT

Re: How to improve the performance of my SQL query?

2023-07-26 Thread gzh
Thank you very much for taking the time to reply to my question. >You might want to check your description of the table definitions. >Going by the above EXPLAIN ANALYZE output, it very much does not look >like ms_cd is the primary key of TBL_SHA. If it is then it's very >weird that you have

Re: Difference in the tablespace folders on primary and secondary nodes

2023-07-26 Thread Abhishek Bhola
Hi Stephen I got the latest documentation and understood that I was supposed to run `select * from pg_backup_stop();` and store the labelfile output to a file in the data directory of the secondary