Re: find replication slots that "belong" to a publication

2025-04-07 Thread Laurenz Albe
On Mon, 2025-04-07 at 22:32 +0200, Willy-Bas Loos wrote: > I find it very strange, because the publication is needed to make a > subscription, which makes the slot. Right, but that information is only on the subscriber. Yours, Laurenz Albe

Re: find replication slots that "belong" to a publication

2025-04-07 Thread Adrian Klaver
On 4/7/25 13:32, Willy-Bas Loos wrote: Hi Laurenz, Thanks for answering! I find it very strange, because the publication is needed to make a subscription, which makes the slot. From here: https://www.postgresql.org/docs/current/logical-replication-subscription.html "A subscription defines t

Re: find replication slots that "belong" to a publication

2025-04-07 Thread Justin
I can't think of a way to link publication to a replication slot I agree using pg_state_activity is the only way to do that however you don't know if the subscriber is momentary disconnected due network error or disconnected due to an error in replication such as duplicated key SELECT true f

Re: Slow timestamp query after upgrading from Pg13 to Pg16

2025-04-07 Thread Adrian Klaver
On 4/7/25 12:25, Simon Windsor wrote: Hi We used pg_dump|pg_restore to migrate the data. Did you do an ANALYZE on the Postgres 16 instance after the pg_restore? The full explain plan is at https://explain.depesz.com/s/742M. The SQL explain (analyze, buffers) select count(*) from consignmen

Re: Slow timestamp query after upgrading from Pg13 to Pg16

2025-04-07 Thread Simon Windsor
Hi We used pg_dump|pg_restore to migrate the data. The full explain plan is at https://explain.depesz.com/s/742M. The SQL explain (analyze, buffers) select count(*) from consignments where (req_status_tstamp >= '2025-03-28 00:00'::timestamp and req_status_tstamp <= '2025-03-28 01:00'::timesta

Re: Performance regression when adding LIMIT 1 to a query

2025-04-07 Thread Costa Alexoglou
On Mon, Apr 7, 2025 at 4:06 PM Artur Zakirov wrote: > On Mon, 7 Apr 2025 at 14:45, Costa Alexoglou wrote: > > ... > > with a plan: > > ``` > > Gather Merge (cost=115584.47..118515.35 rows=25120 width=824) (actual > time=46.004..74.267 rows=29653 loops=1) > > Workers Planned: 2 > > Workers L

Slow timestamp query after upgrading from Pg13 to Pg16

2025-04-07 Thread Simon Windsor
Hello After upgrading a Db from Pg13 (Centos) to Pg16(Ubuntu) some queries on a simple, large table (200M rows) are very slow id integer not null status char(4) not null status_tstamp timestamp <... other columns ...> If I create indexes on * status, status_tstamp * status_tstamp when stat

Re: Custom index access method for primary keys

2025-04-07 Thread Tom Lane
Fabian Lindfors writes: > Hi! I’m working on an index access method that I intend to be > generic and to replace btree for my specific use case. I noticed > though that it doesn’t seem to be possible to specify an access > method when creating a new table and using PRIMARY KEY. There's some work

Re: Performance regression when adding LIMIT 1 to a query

2025-04-07 Thread Artur Zakirov
On Mon, 7 Apr 2025 at 14:45, Costa Alexoglou wrote: > ... > with a plan: > ``` > Gather Merge (cost=115584.47..118515.35 rows=25120 width=824) (actual > time=46.004..74.267 rows=29653 loops=1) > Workers Planned: 2 > Workers Launched: 2 > -> Sort (cost=114584.45..114615.85 rows=12560 widt

Re: find replication slots that "belong" to a publication

2025-04-07 Thread Laurenz Albe
On Mon, 2025-04-07 at 12:16 +0200, Willy-Bas Loos wrote: > My question is not so much about "can i drop a certain replication slot",  > more about "does this publication still have any replication slots?". > Or, if you will: "what's the publication for this replication slot?". > > I've double chec

Performance regression when adding LIMIT 1 to a query

2025-04-07 Thread Costa Alexoglou
Hey folks, I faced an interesting regression and would love to have some help understanding why this happened. The postgres version if it's of any use is PostgreSQL 16.3 . The following query: ``` EXPLAIN ANALYZE SELECT "databases_metrics"."metrics" FROM "databases_metrics" WHERE ( "data

Re: find replication slots that "belong" to a publication

2025-04-07 Thread Willy-Bas Loos
Hi Justin, thanks for your anwer! My question is not so much about "can i drop a certain replication slot", more about "does this publication still have any replication slots?". Or, if you will: "what's the publication for this replication slot?". I've double checked the views that you suggested,

Re: Will PQsetSingleRowMode get me results faster?

2025-04-07 Thread Laurenz Albe
On Fri, 2025-04-04 at 13:41 +0200, Stijn Sanders wrote: > On Mon, Jan 6, 2025 at 9:06 PM Tom Lane wrote: > > So in principle, you might get best results by defining your query > > with DECLARE CURSOR and then using PQsetSingleRowMode on the FETCH. > > But it'd really depend on the particular query

Re: Kubernetes, cgroups v2 and OOM killer - how to avoid?

2025-04-07 Thread Laurenz Albe
On Sat, 2025-04-05 at 13:53 +0200, Ancoron Luciferis wrote: > I've been investigating this topic every now and then but to this day > have not come to a setup that consistently leads to a PostgreSQL backend > process receiving an allocation error instead of being killed externally > by the OOM k

Kubernetes, cgroups v2 and OOM killer - how to avoid?

2025-04-07 Thread Ancoron Luciferis
Hi, I've been investigating this topic every now and then but to this day have not come to a setup that consistently leads to a PostgreSQL backend process receiving an allocation error instead of being killed externally by the OOM killer. Why this is a problem for me? Because while applicati

Custom index access method for primary keys

2025-04-07 Thread Fabian Lindfors
Hi! I’m working on an index access method that I intend to be generic and to replace btree for my specific use case. I noticed though that it doesn’t seem to be possible to specify an access method when creating a new table and using PRIMARY KEY. Same applies to altering a table to add a primar

Re: Will PQsetSingleRowMode get me results faster?

2025-04-07 Thread Stijn Sanders
On Mon, Jan 6, 2025 at 9:06 PM Tom Lane wrote: > So in principle, you might get best results by defining your query > with DECLARE CURSOR and then using PQsetSingleRowMode on the FETCH. > But it'd really depend on the particular query whether this gives > any benefit. That's a really nice suggest