pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPicking up strange queries for "pg_catalog"
3+ messages / 2 participants
[nested] [flat]
* Picking up strange queries for "pg_catalog"
@ 2010-07-04 11:13 Graham Leggett <minfrin@sharp.fm>
0 siblings, 1 reply; 3+ messages in thread
From: Graham Leggett @ 2010-07-04 11:13 UTC (permalink / raw)
To: pgsql-jdbc
Hi all,
While investigating some performance issues with a database, I have
been analysing the database queries, and have discovered that I am
getting thousands and thousands of queries that look like the ones
below.
Asking on the pgsql-general list, I was pointed in the direction of
the jdbc driver, which in theory is making these queries, but not
caching them.
Does this look familiar to anybody?
In addition to this, I am using the atomikos XA transaction manager,
could this be the source of these queries?
Is there anything I can do to stop these queries being made?
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '4'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '4'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '5'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '5'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '8'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '8'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '9'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '9'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '7'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '7'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '10'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '10'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT attnotnull
FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '6'
2010-07-03 23:49:31 SAST LOG: execute <unnamed>: SELECT def.adsrc
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
(a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
(a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
2010-07-03 23:49:31 SAST DETAIL: parameters: $1 = '29427', $2 = '6'
Regards,
Graham
--
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Picking up strange queries for "pg_catalog"
@ 2010-07-04 11:25 Thomas Kellerer <spam_eater@gmx.net>
parent: Graham Leggett <minfrin@sharp.fm>
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Kellerer @ 2010-07-04 11:25 UTC (permalink / raw)
To: pgsql-jdbc
Graham Leggett wrote on 04.07.2010 13:13:
> Hi all,
>
> While investigating some performance issues with a database, I have been
> analysing the database queries, and have discovered that I am getting
> thousands and thousands of queries that look like the ones below.
>
> Asking on the pgsql-general list, I was pointed in the direction of the
> jdbc driver, which in theory is making these queries, but not caching them.
>
> Does this look familiar to anybody?
>
> In addition to this, I am using the atomikos XA transaction manager,
> could this be the source of these queries?
>
I don't think it's the driver "making" these calls. Some of them look like they are a result of calling severl JDBC metadata API functions (e.g DatabaseMetaData.getColumns() or something similar) which in turn are not initiated by the driver, but by the client software. So I would suspect the transaction manager or your ORM library to make those calls (and thus generating the queries)
Thomas
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Picking up strange queries for "pg_catalog"
@ 2010-07-07 00:36 Graham Leggett <minfrin@sharp.fm>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 0 replies; 3+ messages in thread
From: Graham Leggett @ 2010-07-07 00:36 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-jdbc
On 04 Jul 2010, at 1:25 PM, Thomas Kellerer wrote:
> I don't think it's the driver "making" these calls. Some of them
> look like they are a result of calling severl JDBC metadata API
> functions (e.g DatabaseMetaData.getColumns() or something similar)
> which in turn are not initiated by the driver, but by the client
> software. So I would suspect the transaction manager or your ORM
> library to make those calls (and thus generating the queries)
I have managed to isolate at least one of the strange queries to a
call to the "getColumnTypeName()" method on the following object:
org.postgresql.jdbc3.Jdbc3ResultSetMetaData
The debugger catches what I think are internal fields inside the above
object called "schemaNameCache" and "tableNameCache", both of which
are null.
In theory it looks like the Jdbc3ResultSetMetaData object is firing
off database queries on calls to metadata methods over and over again.
Am I on the right track, and if so, is there a way to get the JDBC
driver's org.postgresql.jdbc3.Jdbc3ResultSetMetaData object to cache
these calls so that they aren't as expensive?
Regards,
Graham
--
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2010-07-07 00:36 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04 11:13 Picking up strange queries for "pg_catalog" Graham Leggett <minfrin@sharp.fm>
2010-07-04 11:25 ` Thomas Kellerer <spam_eater@gmx.net>
2010-07-07 00:36 ` Graham Leggett <minfrin@sharp.fm>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox