Dremio force update query plan

Hello we are optimizing some queries, but I noticed that Dremio not refreshes cache query plan for example we have a table without partition and run a query, then create partition in table or recreate table with partition, run refresh metadata and then run query again and Dremio still uses old query plan without partition and show

Cached Plan is used for the query, the cached plan entry has been used 3 times
has Dremio some sentence to force clear query plan cache

@dacopan Partition pruning should happen, are you able to send both profiles? one that uses pruning while the other that uses cache and then does not use partition? Once you have the profiles, do forget metadata and then refresh, then retry

1 Like

If you set planner.query_plan_cache_enabled to false and wait 30 seconds, it’ll clear the plan cache across all coordinators and then you can re-enable it.

You can also force an immediate refresh on the current coordinator using:

alter system clear plan cache;

But as Balaji says, any change to the table metadata should have invalidated the plan cache automatically.

1 Like

thank you @Benny_Chow and @balaji.ramaswamy I’ll try reproduce error again and report here, but I think the problem is only when drop table and create again