Slow JSON Data Retrieval from PostgreSQL


I am currently working with 30,000 - 50,000 rows of JSONB Data saved inside PostgreSQL. Querying JSON is fast for my python and psycopg2 use case, but when I tried running the same query inside metabase it slows down.

Here is a sample query:

SELECT count(*) as count, information::json->-1->‘definition’->‘answer’ as answer from questions group by questions.status;

Could the problem here, be the way how I built my query (which means I must further optimize my query ) or is there something happening inside metabase once it receives the data from postgres

Note: The answer response is still a JSON in the form of

id: 1,
answer: ‘The answer’,
timestamp: time,
user: username