Re: System Query hit to Database

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: System Query hit to Database
Date: 2016-02-11 06:57:54
Message-ID: n9hbdl$8vv$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

dhaval jaiswal schrieb am 11.02.2016 um 06:02:
> Kindly redirect me to the correct forum, If below question is not relevant to you.
>
>
> I am getting lot of following queries on my Database. I need your help to stop hitting this kind of queries to database.
>
> While going through search found the following article saying it's caused by jdbc driver.
>
> http://stackoverflow.com/questions/5453992/a-very-strange-sql-of-postgresql
>
> SELECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, c.relname AS
> TABLE_NAME, CASE n.nspname ~ '^pg_' OR n.nspname =
> 'information_schema' WHEN true THEN CASE WHEN n.nspname =
> 'pg_catalog' OR n.nspname = 'information_schema' THEN CASE c.relkind
> WHEN 'r' THEN 'SYSTEM TABLE' WHEN 'v' THEN 'SYSTEM VIEW' WHEN 'i'
> THEN 'SYSTEM INDEX' ELSE NULL END WHEN n.nspname = 'pg_toast'
> THEN CASE c.relkind WHEN 'r' THEN 'SYSTEM TOAST TABLE' WHEN 'i'
> THEN 'SYSTEM TOAST INDEX' ELSE NULL END ELSE CASE c.relkind WHEN
> 'r' THEN 'TEMPORARY TABLE' WHEN 'i' THEN 'TEMPORARY INDEX' WHEN
> 'S' THEN 'TEMPORARY SEQUENCE' WHEN 'v' THEN 'TEMPORARY VIEW' ELSE
> NULL END END WHEN false THEN CASE c.relkind WHEN 'r' THEN
> 'TABLE' WHEN 'i' THEN 'INDEX' WHEN 'S' THEN 'SEQUENCE' WHEN 'v'
> THEN 'VIEW' WHEN 'c' THEN 'TYPE' ELSE NULL END ELSE NULL END AS
> TABLE_TYPE, d.description AS REMARKS FROM pg_catalog.pg_namespace n,
> pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_description d ON
> (c.oid = d.objoid AND d.objsubid = 0) LEFT JOIN pg_catalog.pg_class
> dc ON (d.classoid=dc.oid AND dc.relname='pg_class') LEFT JOIN
> pg_catalog.pg_namespace dn ON (dn.oid=dc.relnamespace AND
> dn.nspname='pg_catalog') WHERE c.relnamespace = n.oid AND c.relname
> LIKE 'PROBABLYNOT' AND (false OR ( c.relkind = 'r' AND n.nspname !~
> '^pg_' AND n.nspname <> 'information_schema' ) ) ORDER BY
> TABLE_TYPE,TABLE_SCHEM,TABLE_NAME
>

this is the query sent by getTables() (as mention on Stackoverflow).

There are some connection pools out there that have a stupid default configuration and use getTables() as the query to validate if a connection is still alive. If you additionally have enabled validating connections when they are taken out or returned to the pool, this will be called for each "getConnection()" inside your code.

Check the configuration of your connection pool.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message John R Pierce 2016-02-11 07:26:48 Re: System Query hit to Database
Previous Message dhaval jaiswal 2016-02-11 05:02:25 System Query hit to Database