Closed paoliniluis closed 1 year ago
Just to confirm, do you see this only when you save the question or also when you run it?
Just when editing the question
It turns out Metabase is calling the Trino query twice. The first time is supposed to be just a cursor, but that feature doesn't exist with Trino.
Because there is no way to differentiate the call which should trigger a query and the call which does not (at least yet), closing this issue.
To reproduce: 1) Connect Metabase with a postgres db 2 times, first one directly (without Trino in the middle), second one via Trino (as a catalog) 2) Create a SQL question (e.g. with the sample dataset): select from "public"."people" and save it without running 3) now edit the SQL question (e.g. select "public"."people". from "public"."people") and see the difference:
If connecting Metabase with a postgres directly, Metabase will open 2 cursors and fire the query once. This is the log:
But if you do the same via Trino, you'll see the following log lines: Step 2: Trino is syncing the table schema, creating the cursor AND running the question, even though in Metabase
Step 3: Trino syncs again the table schema, now twice, and creates 2 cursors and also fires the query twice