Re: query plan

2023-11-17 Thread Tom Lane
=?UTF-8?Q?Torsten_F=C3=B6rtsch?= writes: > This is part of a query plan: > Nested Loop Left Join (cost=26.32..47078866.36 rows=1344945195 width=626) >-> Nested Loop Left Join (cost=25.74..5312.48 rows=1344945195 > width=608) > -> Nested Loop Left Join (cost=6.79..2876.77

query plan

2023-11-17 Thread Torsten Förtsch
Hi, This is part of a query plan: Nested Loop Left Join (cost=26.32..47078866.36 rows=1344945195 width=626) -> Nested Loop Left Join (cost=25.74..5312.48 rows=1344945195 width=608) -> Nested Loop Left Join (cost=6.79..2876.77 rows=102 width=373) -> Nested Loop

Re: Trigger to Count Number of Logical Replication Table Changes.

2023-11-17 Thread Juan Rodrigo Alejandro Burgos Mella
Hi The only thing that can be established is that if the record does not exist, the trigger will not be updating anything in the table "tst.time_audit_tbl" for the condition "table_name = CONCAT(TG_TABLE_SCHEMA, '.', TG_TABLE_NAME)" Maybe, checking before the UPDATE, if the record does not exist,

Re: Unused CTE affects result set

2023-11-17 Thread Tom Lane
Adrian Klaver writes: > On 11/17/23 10:30 AM, Gabriel Sánchez wrote: >> I don't understand why the presence of a CTE that ends up not being >> included in the final query affects the result set. Could this be a >> bug, or is there something I don't understand? > I would say it has to do with

Re: Unused CTE affects result set

2023-11-17 Thread Adrian Klaver
On 11/17/23 10:30 AM, Gabriel Sánchez wrote: Dear Postgres community, I'm seeing unintuitive behavior with a query structured as follows: WITH used_cte (SELECT a, b, c FROM t1 ...) , unused_cte (SELECT d, e, f FROM t2 ...) SELECT * FROM used_cte ... -- returns no results WITH used_cte

Unused CTE affects result set

2023-11-17 Thread Gabriel Sánchez
Dear Postgres community, I'm seeing unintuitive behavior with a query structured as follows: WITH used_cte (SELECT a, b, c FROM t1 ...) , unused_cte (SELECT d, e, f FROM t2 ...) SELECT * FROM used_cte ... -- returns no results WITH used_cte (SELECT a, b, c FROM t1 ...) -- , unused_cte (SELECT

Re: PostgreSQL statistics

2023-11-17 Thread Adrian Klaver
On 11/17/23 02:25, Paulo Silva wrote: Hi, I have a table in a PostgreSQL 11 server that isn't being used a lot. If I run a manual ANALYSE on it the last_analyse statistic isn't being update (I've waited enough time for it to be updated): # SELECT * FROM pg_catalog.pg_stat_user_tables WHERE

PostgreSQL statistics

2023-11-17 Thread Paulo Silva
Hi, I have a table in a PostgreSQL 11 server that isn't being used a lot. If I run a manual ANALYSE on it the last_analyse statistic isn't being update (I've waited enough time for it to be updated): # SELECT * FROM pg_catalog.pg_stat_user_tables WHERE schemaname='s1' and relname='t1'; relid