How to improve performance in data present in pivod table?

data present as table about 4~5 seconds.

data present as pivod table cost 1 min 20 seconds.

Hi @Jay
Post "Diagnostic Info" from Admin > Troubleshooting, and which database you're querying.
Pivot Table does a lot of extra queries to calculate the subtotals, so if your database is not fully indexed for such queries, then those queries will take a lot longer. Check your database query log.

my db is SQL SERVER 2019

"browser-info": {
"language": "zh-TW",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
"vendor": "Google Inc."
"system-info": {
"file.encoding": "UTF-8",
"": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.10+9",
"java.vendor": "AdoptOpenJDK",
"java.vendor.url": "",
"java.version": "11.0.10",
"": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.10+9",
"": "Linux",
"os.version": "5.4.0-73-generic",
"user.language": "en",
"user.timezone": "GMT"
"metabase-info": {
"databases": [
"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-03-17",
"tag": "v0.38.2",
"branch": "release-x.38.x",
"hash": "91f0ed6"
"settings": {
"report-timezone": "Asia/Taipei"

Check your database logs, which might help you to explain why the queries are slow.

You can try the latest release, 0.40.2, since there's constantly performance improvements:

You should migrate away from H2 if you are using Metabase in production:

I try to upgrade my Docker to MariaDB DB, but when RUN
java -jar metabase.jar load-from-h2 /path/to/metabase.db
it show metabase.jar: No such file or directory
and I can't fine metabase.jar in docker environment.

@Jay If you are not familiar with Docker, then I would highly recommend that you just use JAR:

As noted in the migration guide, it is recommended to run the migration by itself, since it's just a one-off process:

Hi Flamber:
After many times try and error, I got some progress on the H2->Postgrsql, but get some error as below. Need you help!!

at metabase.cmd.copy$insert_chunk_BANG_.invokeStatic(copy.clj:112)
at metabase.cmd.copy$insert_chunk_BANG_.invoke(copy.clj:106)
at metabase.cmd.copy$copy_data_BANG_$fn__74842$fn__74843.invoke(copy.clj:141)
... 51 more
Caused by: org.postgresql.util.PSQLException: ERROR: column "semantic_type" of relation "metabase_field" does not exist
Position: 62
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
at org.postgresql.core.v3.QueryExecutorImpl.processResults(
at org.postgresql.core.v3.QueryExecutorImpl.execute(
at org.postgresql.jdbc.PgStatement.internalExecuteBatch(
... 66 more
Command failed with exception: Error copying instances of Field

@Jay It looks like you have tried to migrate and upgrade at the same time, which is not recommended:

So first make sure you're using 0.41.4 on H2, verify everything works, then migrate (again with 0.41.4), and then run 0.41.4 on Postgres.