Filter efficiently using jsonb with sdk
Hello,
I'm trying to make a query to a table that includes a bunch of data in a jsonb field. I need to filter this data from a specific field inside the json that is indexed in postgres.
The raw SQL query that is efficient is the following:
Using the python sdk that makes the following code:
However the issue is that using the sdk the request is taking a very long time. After analyzing in Query Performance page. And I found out that the actuall SQL query run from the sdk is the following:
The issue is the use of "to_jsonb" that prevents the query to use the indexes on the jsonb field. That is very UNefficient.
Is there any way to avoid this using the sdk ?
I'm trying to make a query to a table that includes a bunch of data in a jsonb field. I need to filter this data from a specific field inside the json that is indexed in postgres.
The raw SQL query that is efficient is the following:
Using the python sdk that makes the following code:
However the issue is that using the sdk the request is taking a very long time. After analyzing in Query Performance page. And I found out that the actuall SQL query run from the sdk is the following:
The issue is the use of "to_jsonb" that prevents the query to use the indexes on the jsonb field. That is very UNefficient.
Is there any way to avoid this using the sdk ?