Card shows fresh data but downloaded file shows an old instance of the data

Cards on metabase show correct data. However when the data is downloaded, it is pre-dated data - probably from a cache.

I currently use Metabase v0.40.1. Below is a reproducible example

SELECT *,CURRENT_DATE AS execution_date FROM table1 a LEFT JOIN table2 b ON a.id = b.foreign_id 

In the UI, the correct result is shown (still facing cache issues regularly but that can be handled by changing just one line in the query and running again or refreshing) but when the data is downloaded(CSV,JSON or xlsx), the data in the downloaded file does not correspond with the data in the UI. However, the execution_date field alone is correctly populated with the current date. Have tried a lot of ways(refreshing webpage, restarting browser, etc.) to handle this issue but nothing is currently working. The issue just resolves itself after a couple of tries/minutes.

Any ideas on how I can work around this issue would be much appreciated.

Hi @the_adhi_porter
Please post "Diagnostic Info" from Admin > Troubleshooting.

Do you have caching enabled? Admin > Settings > Caching

Exports does not use cache, so that cannot be the reason. But perhaps you have database cache?

How many instances of Metabase are you running?

Hi @flamber
Working with OP. Sharing some requested details.

Caching enabled : Yes.

MINIMUM QUERY DURATION : 15 seconds
CACHE TIME-TO-LIVE (TTL) MULTIPLIER : 3000
MAX CACHE ENTRY SIZE : 1000

No idea about database cache. But have asked infra team. Will share details later.

We run 1 single instance of Metabase. Not sure where to find extra info on this - if any.

Diagnostic info below

{
  "browser-info": {
    "language": "en-US",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 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": "4.14.158-129.185.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "h2",
      "redshift"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "9.6.22"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.18"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2021-07-14",
      "tag": "v0.40.1",
      "branch": "release-x.40.x",
      "hash": "ed8f9c8"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

@ArgoSorcerer Okay, caching on works on saved questions. It does not apply to exports or ad-hoc queries.

Since I don't know which database you are querying, then unsure if you might have a database cache layer.

I can see you have 3 database types connected to Metabase. So if you make a query similar to what was described initially for all 3 databases, since that would test the idea of a database cache layer.