how can i get query_hash by card_id

because i want to refresh query_cache result by card_id

Hi @Jakin
Have a look in query_execution to match hashes with questions.

in my db result:
select count(*)
from query_cache where query_hash in (select hash from query_execution) select result only 10 rows.

select count(*) from query_execution result is 1718802 rows.

select count(*) from query_cache result is 29910 rows

so i do not agree this answer.

Pls tell me why.

@Jakin Post "Diagnostic Info" from Admin > Troubleshooting.
I'm guessing that you might be seeing this issue:
https://github.com/metabase/metabase/issues/16517 - upvote by clicking :+1: on the first post
Or perhaps:
https://github.com/metabase/metabase/issues/18777 - upvote by clicking :+1: on the first post

from this issue https://github.com/metabase/metabase/issues/16517, you said that since x.37.6 , query_cache.hash is not equal to query_execution.hash.
I want to know if i can fix it by upgrade metabase version.

and then , i see 16517 and 18777 issues, it did not give soultion tog solve my question.

@Jakin Post "Diagnostic Info" from Admin > Troubleshooting

this is my diagnostic info

"browser-info": {
"language": "zh-CN",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36",
"vendor": "Google Inc."
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.11+9",
"java.vendor": "AdoptOpenJDK",
"java.vendor.url": "https://adoptopenjdk.net/",
"java.version": "11.0.11",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.11+9",
"os.name": "Linux",
"os.version": "3.10.0-1160.15.2.el7.x86_64",
"user.language": "en",
"user.timezone": "GMT"
"metabase-info": {
"databases": [
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MySQL",
"version": "8.0.18"
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.6.2"
"run-mode": "prod",
"version": {
"date": "2021-12-23",
"tag": "v0.0.1-SNAPSHOT",
"branch": "?",
"hash": "?"
"settings": {
"report-timezone": null

@Jakin Well, I have absolutely no idea which version you're using, since that's a custom build.

But whatever you're asking for is not possible until the two issues are fixed.

oh no.
as you said, you know metabase has two issues. but the dev team has no plan to fix it.??

Or you can tell me whether the upgraded version can solve the problem.

We need to solve this problem very urgently.

When we enable a long cache time, our data needs to be refreshed in a specified time period

@Jakin Again, I have absolutely no idea which version you are using. You are running a custom build. I will absolutely not try to give support to a custom build unless you are one of our Enterprise customers.

There are 2000+ other open issues. We want to address all bugs, but I cannot give you a timeline.

If you want us to prioritize an issue, then we have Enterprise editions, which gives more priority to issues that are affecting you: https://www.metabase.com/pricing/

If you are using the free open source edition, then you're welcome to submit a PR.

OK. thank you