Can I delete data on query table

Currently, we have 3M rows (with ~30GB stored) on query table. Can I delete data on this table?
SQL get data storage:
select pgs.schemaname, pgs.tablename, pgc.reltuples as num_rows, count(pgs.attname) as num_columns, sum(pgs.avg_width)pgc.reltuples/(10241024) as table_size_mb
from pg_stats pgs left join (SELECT nspname AS schemaname, relname, reltuples
from pg_class C
left join pg_namespace N ON (N.oid = C.relnamespace)
where relkind=‘r’
) pgc
on pgs.schemaname = pgc.schemaname and pgs.tablename = pgc.relname
where tablename = ‘query’
group by 1, 2, 3

Hi @dungngo2912
I’m not sure I understand. If you want to use Metabase to delete data, then no, Metabase only has read access to your database, so you would need to delete data with another tool.

@flamber Yep, I do understand. In my case, query table created by Metabase and it on PostgreSQL Database I used when setup Metabase. I think this table seem to table query_execution so I want to delete its data.

Ahh, okay, yes you can trunacte query_execution or make a script that cleanup daily.
There’s an issue open about controlling size of the table:

@flamber Yep. I truncated table query_execution but can I do seem with table query???


I’ve never tried with query. I’m not sure if it is used by other tables.
You can try renaming the table, and create a new table with same structure in it’s place.

@flamber Ok thanks U, i will try with your suggest solution. Waiting for my good news.