Inside of Metabase I have a pretty simple save question, which just counts the rows in a table. Call this Count of row in table A". The query obviously finishes executing very quickly.
However, if I choose to sandbox table A, then the query becomes very slow. I'm talking 20 - 30 seconds.
My sandboxing is using a saved question and the save question looks like:
Table A
Join data
Table A (left join) Table B on TableA.table_b_id = TableB.id
Join data
Table B (left join) Table C on TableB.table_c_id = TableC.id
Join data
Table C (left join) Table D on TableC.table_d_id = TableD.id
So a very simple joining structure with 3 joins. My sandboxing then uses a variable on a column inside of Table D to actually perform the sandboxing.
I'm not sure if it's important, but tables B and C and D are also all individually sandboxed themselves in the same manner. For example, Table B is sandboxed like
Table B
Join data
Table B (left join) Table C on TableB.table_c_id = TableC.id
Join data
Table C (left join) Table D on TableC.table_d_id = TableD.id
with again the actual sandboxing variable being a column in Table D.
Does anyone know why this sanboxing structure would be very slow for such a simple query like counting all rows?
Addition context:
- I am not selecting any columns from any joined tables
- I am using the hosted version of Metabase