Thread: performance issue: a lot of pg_catalog queries from info.c

performance issue: a lot of pg_catalog queries from info.c

From
"Pliszka, Jacek"
Date:

Hi!

 

I’ve compared queries sent by PostgreSQL and MySQL ODBC driver and I’ve noticed that PG has thousands of queries like

Below which are not present in MySQL and what is one of the main reasons why PG ODBC is significantly slower:

 

SELECT ta.attname,        ia.attnum,        ic.relname,         n.nspname,        tc.relname

FROM pg_catalog.pg_attribute ta,      pg_catalog.pg_attribute ia,      pg_catalog.pg_class tc,

     pg_catalog.pg_index i,      pg_catalog.pg_namespace n,      pg_catalog.pg_class ic

WHERE tc.oid = 17195

  AND tc.oid = i.indrelid

  AND n.oid = tc.relnamespace

  AND i.indisprimary = 't'

  AND ia.attrelid = i.indexrelid

  AND ta.attrelid = i.indrelid

  AND ta.attnum = i.indkey[ia.attnum-1]

  AND (NOT ta.attisdropped)

  AND (NOT ia.attisdropped)

  AND ic.oid = i.indexrelid

ORDER BY ia.attnum

 

My uneducated guess is that these queries come from  info.c  line 3795.

 

Do they really have to be send to backend so often ?   In one minute the above query for 17195 was sent

312 times,  for 16774 311 times etc.

 

Every 3rd query was of this type!

 

Is there any option in the driver that could disable sending so many queries of this type?

 

BR,

 

Jacek