Re: Is it possible to index "deep" into a JSONB column?

2022-05-29 Thread Bryn Llewellyn
> shaheedha...@gmail.com wrote: > > Suppose I have a JSONB field called "snapshot". I can create a GIN > index on it like this: > > create index idx1 on mytable using gin (snapshot); > > In principle, I believe this allows index-assisted access to keys and > values nested in arrays and inner ob

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Rob Sargent
On 5/29/22 18:00, Adrian Klaver wrote: On 5/29/22 15:03, Tom Lane wrote: Adrian Klaver writes: On 5/29/22 13:59, Alastair McKinley wrote: I think Tom was able to reproduce this by the sounds of his response? I have not received that post yet. I do see it in the archives. I re-addressed i

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Adrian Klaver
On 5/29/22 15:03, Tom Lane wrote: Adrian Klaver writes: On 5/29/22 13:59, Alastair McKinley wrote: I think Tom was able to reproduce this by the sounds of his response? I have not received that post yet. I do see it in the archives. I re-addressed it to pgsql-bugs, maybe you are not subsc

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Tom Lane
Adrian Klaver writes: > On 5/29/22 13:59, Alastair McKinley wrote: >> I think Tom was able to reproduce this by the sounds of his response? > I have not received that post yet. I do see it in the archives. I re-addressed it to pgsql-bugs, maybe you are not subscribed to that?

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Adrian Klaver
On 5/29/22 13:59, Alastair McKinley wrote: > > From: Adrian Klaver > Sent: 29 May 2022 21:47To: Alastair McKinley Hi Adrian, I am running the function "select test_notice();" from the psql console with psql/server versions 15beta1. In psql 15beta1, the notice appears only after the fu

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Alastair McKinley
> > From: Adrian Klaver > Sent: 29 May 2022 21:47To: Alastair McKinley > ; pgsql-general@lists.postgresql.org > Subject: Re: psql 15beta1 does not print > notices on the console until transaction completes > > On 5/29/22 13:11, Alastair McKinley wrote: > > Hi all, > > > > I notice this change i

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Adrian Klaver
On 5/29/22 13:47, Adrian Klaver wrote: On 5/29/22 13:11, Alastair McKinley wrote: Hi all, In psql 15beta1, the "hello" message only appears on the console when the transaction completes. I am not seeing that. I take that back, I was using psql 14.3 to connect to the 15 instance. When I c

Is it possible to index "deep" into a JSONB column?

2022-05-29 Thread Shaheed Haque
Suppose I have a JSONB field called "snapshot". I can create a GIN index on it like this: create index idx1 on mytable using gin (snapshot); In principle, I believe this allows index-assisted access to keys and values nested in arrays and inner objects but in practice, it seems the planner "oft

Re: psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Adrian Klaver
On 5/29/22 13:11, Alastair McKinley wrote: Hi all, I notice this change in behaviour with psql in 15beta1 when testing an existing codebase. I didn't see any mention of this change in the release notes and it surprised me. Using this test function:     create or replace function test_notic

psql 15beta1 does not print notices on the console until transaction completes

2022-05-29 Thread Alastair McKinley
Hi all, I notice this change in behaviour with psql in 15beta1 when testing an existing codebase. I didn't see any mention of this change in the release notes and it surprised me. Using this test function:     create or replace function test_notice() returns void as     $$     begin   

Re: Function definition regression in 15beta1 when specific parameter name (string) is used

2022-05-29 Thread Alastair McKinley
> From: Tom Lane > Sent: 29 May 2022 18:43 > To: Alastair McKinley > Cc: Andrew Dunstan ; pgsql-general@lists.postgresql.org > > Subject: Re: Function definition regression in 15beta1 when specific > parameter name (string) is used > > Alastair McKinley writes: > > The following function d

Re: Function definition regression in 15beta1 when specific parameter name (string) is used

2022-05-29 Thread Tom Lane
Alastair McKinley writes: > The following function definition fails in 15beta1 (ok in 14.3): > create or replace function regexp_match_test(string text,pattern text) > returns text[] as > $$ > select regexp_match(string,pattern); > $$ language sql; Commit 1a36bc9db seems to

Re: Function definition regression in 15beta1 when specific parameter name (string) is used

2022-05-29 Thread Adrian Klaver
On 5/29/22 10:29, Adrian Klaver wrote: On 5/29/22 09:46, Alastair McKinley wrote: Hi all, Postgres 15: https://www.postgresql.org/docs/15/sql-keywords-appendix.html STRING reserved (can be function or type) non-reserved Postgres 14: https://www.postgresql.org/docs/14/sql-keyword

Re: Function definition regression in 15beta1 when specific parameter name (string) is used

2022-05-29 Thread Adrian Klaver
On 5/29/22 09:46, Alastair McKinley wrote: Hi all, I was testing an existing codebase with 15beta1 and ran into this issue. I reduced the test case to an example with works in 14.3, and fails in 15beta1. The following function definition fails in 15beta1 (ok in 14.3): create or replace f

Function definition regression in 15beta1 when specific parameter name (string) is used

2022-05-29 Thread Alastair McKinley
Hi all, I was testing an existing codebase with 15beta1 and ran into this issue. I reduced the test case to an example with works in 14.3, and fails in 15beta1. The following function definition fails in 15beta1 (ok in 14.3): create or replace function regexp_match_test(string text,pattern

Re: JSONB index not in use, but is TOAST the real cause of slow query?

2022-05-29 Thread Shaheed Haque
On Sun, 29 May 2022, 15:58 Tom Lane, wrote: > Shaheed Haque writes: > > Unfortunately, the real query which I think should behave very > > similarly is still at the several-seconds level despite using the > > index. ... > > > -> Bitmap Heap Scan on paiyroll_payrun (cost=26.88..30.91 rows=1 >

Re: autovacuum on primary blocking queries on replica?

2022-05-29 Thread Laurenz Albe
On Fri, 2022-05-27 at 14:00 -0500, Don Seiler wrote: >  * PostgreSQL 12.9 - PGDG Ubuntu 18.04 image >  * Streaming physical replication >  * hot_standby_feedback = on > We use a read replica to offload a lot of (what should be) quick queries. > This morning we had an incident > where these queries

Re: JSONB index not in use, but is TOAST the real cause of slow query?

2022-05-29 Thread Tom Lane
Shaheed Haque writes: > Unfortunately, the real query which I think should behave very > similarly is still at the several-seconds level despite using the > index. ... > -> Bitmap Heap Scan on paiyroll_payrun (cost=26.88..30.91 rows=1 > width=4) (actual time=32.488..2258.891 rows=62 loops=1)

Re: Showing alternative query planner plans with explain ?

2022-05-29 Thread Tom Lane
Danny Shemesh writes: > A tool I seem to be missing, and I wondered if such exists, is to have the > planner output alternative plans for a given query, i.e. to say, give me > the x top plans sorted by cost - I believe this would help shed some light > on the internal state machine and subsequent

Showing alternative query planner plans with explain ?

2022-05-29 Thread Danny Shemesh
Hey all ! I'm currently optimizing queries and indices on a relatively large dataset; one of the frequent questions I seem to ask myself is why the planner chooses plan A over B. Reading the docs, blogs, stack exchange posts, wiki, ... helps in trying to tinker with the query or indices in a way