Metabase caching works for normal question but not for pivot question

My Metabase is connected to Snowflake. I have caching enabled at Metabase but it is not working for pivot queries. And after some debugging of the network response, I found that ignore-cached-results? parameter is set to True only for the pivot query. Is there a way to set this to False?

Notice the ignore-cached-results parameter in the two responses below.

Response for normal query:

"cached":true,"database_id":3,"started_at":"2022-02-03T17:13:49.098629Z","json_query":{"constraints":{"max-results":10000,"max-results-bare-rows":2000},"type":"query","middleware":{"js-int-to-string?":true,"ignore-cached-results?":false,"process-viz-settings?":false},"database":3,"query":{"source-table":142},"async?":true,"cache-ttl":29430000},"average_execution_time":5677,"updated_at":"2022-01-31T14:28:02.451881Z","status":"completed","context":"question","row_count":2000,"running_time":546}

response for pivot query:

"json_query":{"type":"query","query":{"source-table":226,"breakout":[["field",4141,null],["field",4146,null],["expression","pivot-grouping"]],"aggregation":[["sum",["field",4034,null]]],"expressions":{"pivot-grouping":["abs",0]}},"database":3,"constraints":{"max-results":10000,"max-results-bare-rows":2000},"middleware":{"js-int-to-string?":true,"ignore-cached-results?":true,"add-default-userland-constraints?":true},"cache-ttl":374400,"async?":true},"average_execution_time":null,"status":"completed","context":"question","row_count":15,"running_time":53}

Metabase version: v0.41.0

Diagnostic info:

{
  "browser-info": {
    "language": "en-US",
    "platform": "Linux x86_64",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.12+7",
    "java.vendor": "Eclipse Foundation",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.12",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.12+7",
    "os.name": "Linux",
    "os.version": "5.11.0-1027-aws",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "h2",
      "snowflake"
    ],
    "hosting-env": "unknown",
    "application-database": "h2",
    "application-database-details": {
      "database": {
        "name": "H2",
        "version": "1.4.197 (2018-03-18)"
      },
      "jdbc-driver": {
        "name": "H2 JDBC Driver",
        "version": "1.4.197 (2018-03-18)"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2021-10-06",
      "tag": "v0.41.0",
      "branch": "release-x.41.x",
      "hash": "c529fe2"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Query payload for normal question:

image

Query payload for pivot question:

image

Hi @divyadass
You should upgrade immediately: https://github.com/metabase/metabase/releases/latest
And migrate away from H2 if you are using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

I've created an issue for it:
https://github.com/metabase/metabase/issues/20248 - upvote by clicking :+1: on the first post

1 Like