pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markur Sens <markursens@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Using vars in jsonbpath operator ?
Date: Fri, 16 Jun 2023 14:54:35 +0300
Message-ID: <4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com> (raw)

I understand that on a where clause a gin index can be used for the following predicate

a.data @? '$.results.docs[*].accs[*] ? (@.id == “123")

I have a join query however on the following condition

jsonb_path_exists(a.data, '$.results.docs[*].accs[*] ? (@.number == $id)', jsonb_build_object(‘id', b.id))  but this cannot use a gin index afaik and results in a seq scan.

Is there anyway to use the operator syntax above by passing the b.id <http://b.id/; variable somwehow so that the gin index can be used ? ? =

view thread (2+ messages)  latest in thread

Message-ID: <4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com>
Permalink:  ../4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com/
Also on:    postgresql.org/message-id/4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: markursens@gmail.com
  Subject: Re: Using vars in jsonbpath operator ?
  In-Reply-To: <4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com>
  References: <4A219290-0DC1-4782-85F6-55CA334192C3@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox