Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver performing one metadata query for each 'regular' query #339

Closed
gcobr opened this issue Jun 23, 2015 · 4 comments
Closed

Driver performing one metadata query for each 'regular' query #339

gcobr opened this issue Jun 23, 2015 · 4 comments

Comments

@gcobr
Copy link

gcobr commented Jun 23, 2015

Dear All,

I am using version 9.3-1101 of the JDBC driver against a 9.3 PostgreSQL database.

Apparently the JDBC driver is performing one "metadata query" for each of my regular queries against the DB, which seems to dramatically impact the performance of my applications.

The metadata query looks like this:

SELECT c.oid, a.attnum, a.attname, c.relname, n.nspname, a.attnotnull OR (t.typtype = 'd' AND t.typnotnull), pg_catalog.pg_get_expr(d.adbin, d.adrelid) LIKE '%nextval(%' FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (c.oid = a.attrelid) JOIN pg_catalog.pg_type t ON
(a.atttypid = t.oid) LEFT JOIN pg_catalog.pg_attrdef d ON (d.adrelid = a.attrelid AND d.adnum = a.attnum) JOIN (SELECT 45572361 AS oid , 1 AS attnum UNION ALL SELECT 45572361, 2 UNION ALL SELECT 45572361, 4 UNION ALL SELECT 45572361, 6 UNION ALL SELECT 45572361, 9 UNION ALL SELECT 45572361, 17 UNION ALL SELECT 45572361, 18 UNION ALL SELECT 45572361,
19 UNION ALL SELECT 45572361, 22 UNION ALL SELECT 45572361, 20 UNION ALL SELECT 45572361, 21 UNION ALL SELECT 45572361, 23 UNION ALL SELECT 45572361, 25 UNION ALL SELECT 45572361, 27 UNION ALL SELECT 45572361, 69 UNION ALL SELECT 45572361, 30 UNION ALL SELECT 45572361, 32 UNION ALL SELECT 45572361, 34 UNION ALL SELECT 45572361, 35 UNION ALL SELECT
45572361, 36 UNION ALL SELECT 45572361, 39 UNION ALL SELECT 45572361, 64 UNION ALL SELECT 45572361, 5 UNION ALL SELECT 45572361, 41 UNION ALL SELECT 45572361, 43 UNION ALL SELECT 45572361, 45 UNION ALL SELECT 45572361, 54 UNION ALL SELECT 45572361, 56 UNION ALL SELECT 45572361, 31 UNION ALL SELECT 45572361, 59 UNION ALL SELECT 45572361, 60 UNION ALL
SELECT 45572361, 67 UNION ALL SELECT 45572361, 61 UNION ALL SELECT 45572361, 62 UNION ALL SELECT 45572361, 65 UNION ALL SELECT 45572361, 57 UNION ALL SELECT 45572361, 63 UNION ALL SELECT 45572361, 7 UNION ALL SELECT 45572361, 8 UNION ALL SELECT 45572361, 24 UNION ALL SELECT 45572361, 48 UNION ALL SELECT 45572361, 49 UNION ALL SELECT 45572361, 58
UNION ALL SELECT 45572361, 3 UNION ALL SELECT 45572361, 68 UNION ALL SELECT 45572361, 52 UNION ALL SELECT 45572361, 66 UNION ALL SELECT 45572305, 3 UNION ALL SELECT 45572305, 8 UNION ALL SELECT 45572305, 2) vals ON (c.oid = vals.oid AND a.attnum = vals.attnum) 
SELECT c.oid, a.attnum, a.attname, c.relname, n.nspname, a.attnotnull OR (t.typtype = 'd' AND t.typnotnull), pg_catalog.pg_get_expr(d.adbin, d.adrelid) LIKE '%nextval(%' FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (c.oid = a.attrelid) JOIN pg_catalog.pg_type t ON
(a.atttypid = t.oid) LEFT JOIN pg_catalog.pg_attrdef d ON (d.adrelid = a.attrelid AND d.adnum = a.attnum) JOIN (SELECT 45572305 AS oid , 1 AS attnum UNION ALL SELECT 45572305, 17 UNION ALL SELECT 45572305, 34 UNION ALL SELECT 45572305, 9 UNION ALL SELECT 45572305, 18 UNION ALL SELECT 45572305, 24 UNION ALL SELECT 45572305, 28 UNION ALL SELECT
45572305, 16 UNION ALL SELECT 45572305, 22 UNION ALL SELECT 45572305, 12 UNION ALL SELECT 45572305, 14 UNION ALL SELECT 45572305, 10 UNION ALL SELECT 45572305, 4 UNION ALL SELECT 45572305, 20 UNION ALL SELECT 45572305, 11 UNION ALL SELECT 45572305, 29 UNION ALL SELECT 45572305, 37 UNION ALL SELECT 45572305, 35 UNION ALL SELECT 45572305, 8 UNION ALL
SELECT 45572305, 30 UNION ALL SELECT 45572305, 3 UNION ALL SELECT 45572305, 19 UNION ALL SELECT 45572305, 7 UNION ALL SELECT 45572305, 2 UNION ALL SELECT 45572305, 13 UNION ALL SELECT 45572305, 15 UNION ALL SELECT 45572305, 23 UNION ALL SELECT 45572305, 26 UNION ALL SELECT 45572305, 36) vals ON (c.oid = vals.oid AND a.attnum = vals.attnum) 
SELECT c.oid, a.attnum, a.attname, c.relname, n.nspname, a.attnotnull OR (t.typtype = 'd' AND t.typnotnull), pg_catalog.pg_get_expr(d.adbin, d.adrelid) LIKE '%nextval(%' FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (c.oid = a.attrelid) JOIN pg_catalog.pg_type t ON
(a.atttypid = t.oid) LEFT JOIN pg_catalog.pg_attrdef d ON (d.adrelid = a.attrelid AND d.adnum = a.attnum) JOIN (SELECT 45572305 AS oid , 1 AS attnum UNION ALL SELECT 45572305, 3 UNION ALL SELECT 45572305, 8 UNION ALL SELECT 45572305, 2 UNION ALL SELECT 45572305, 42 UNION ALL SELECT 45572305, 41 UNION ALL SELECT 45572305, 35 UNION ALL SELECT 45572305,
4 UNION ALL SELECT 45572305, 37) vals ON (c.oid = vals.oid AND a.attnum = vals.attnum) 

Is this related to BUG #6293?
http://www.postgresql.org/message-id/201111150859.pAF8xKZW012012@wwwmaster.postgresql.org

If so, has it been fixed in newer versions of the driver?
Is there any way to avoid this strange behavior?

@davecramer
Copy link
Member

I would suggest using the latest version of the 9.4 driver, if that isn't possible at least the most recent version the 9.3 driver which is 1103.

@gcobr
Copy link
Author

gcobr commented Jun 23, 2015

@davecramer Yes, I can upgrade the driver in my environment.
I just wonder if there could be any issue when connecting with the 9.4 driver to a 9.3 database. Can I be sure that it is totally safe?

@davecramer
Copy link
Member

it should be fine...

Dave Cramer

On 23 June 2015 at 15:34, gcobr notifications@github.com wrote:

@davecramer https://github.com/davecramer Yes, I can upgrade the driver
in my environment.
I just wonder if there could be any issue when connecting with the 9.4
driver to a 9.3 database. Can I be sure that it is totally safe?


Reply to this email directly or view it on GitHub
#339 (comment).

@davecramer
Copy link
Member

out of date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants