Unrequested queries

Hi,

I have metabase connected to a postgresql.
Executing:
SELECT * FROM pg_stat_activity WHERE state = 'active';

I've noticed that there's activity from metabase that doesn't come from any user.
These queries are prefixed with "-- Metabase"
I assume they don't come from any user because user queries are prefixed with user id such as "-- Metabase:: userID: 1"

So, What are these queries? Why are they being executed? Can they be disabled?

Thanks

Hi @metaw
Post "Diagnostic Info" from Admin > Troubleshooting, and which queries you're seeing.
I would guess it's sync or scan queries, but that's hard to tell without further information.
https://www.metabase.com/docs/latest/administration-guide/01-managing-databases.html#database-sync-and-analysis

Hi flamber,

Thanks for the reply

{
  "browser-info": {
    "language": "es-ES",
    "platform": "Linux x86_64",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0",
    "vendor": ""
  },
  "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.225-169.362.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "postgres"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "12.5"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.18"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2021-04-27",
      "tag": "v0.39.1",
      "branch": "release-x.39.x",
      "hash": "6beba48"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Queries look like the following:
select <colum_names> from <table_or_view> LIMIT 10000

But I think you might be right, I'll disable these scan options and see what happens

Thanks again

Hi again,

I've disabled everything I could find of sync & scan from database settings on metabase, but I still see queries being executed. Is there anything else I can disable?

@metaw It's difficult to say without seeing the query and matching with the database and the logs - Admin > Troubleshooting > Logs.
You cannot disable sync - and from the looks of it, it seems like it's fingerprinting, which should only be executed ones during the first sync, unless you have enabled re-fringerprinting (Admin > Databases).

Hi,
It's been a while since I last saw another query so I guess it took a while but it finally worked, I'll mark this thread as solved
Thanks

Hi again,

After sync database schema manually I'm seeing this queries again.
They are all like "select [columns] from [table] limit 10000", but some of them take a long time since they are views intended to be filtered always with when clause

Is there any way this can be improved or at least choose when this one time queries are executed?

Thanks

@metaw We are constantly working on improving the sync/scan/fingerprint, but without issues with clear steps on how to reproduce, then it's difficult to address some cases.

  1. Use latest release.
  2. Check the logs for errors - Admin > Troubleshooting > Logs.
  3. You can define when the tasks are executed: https://www.metabase.com/docs/latest/administration-guide/01-managing-databases.html#database-sync-and-analysis