Show max_identifier_length causes heavy query execution
am 26.05.2009 18:48:52 von moreno.d--_aa6f7980-0433-4577-a78b-0261d67b5700_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello all=2C
I noticed that after executing a simple query
that takes few milliseconds=2C the odbc driver executes another query
which takes about 30 seconds to execute=2C because it scans a large table.
This is the part of the log file I think is showing the problem=2C see belo=
w for the entire log file:
[15.534]conn=3D02E72C78=2C query=3D'select count(*) from az001.doc101 where=
(code=2Criga)=3D(1=2C1)
'
[15.552] [ fetched 1 rows ]
[15.608]conn=3D02E72C78=2C query=3D'show max_identifier_length'
[15.619] [ fetched 1 rows ]
[15.660]STATEMENT ERROR: func=3DPGAPI_ColAttributes=2C desc=3D''=2C errnum=
=3D30=2C errmsg=3D'this request may be for MS SQL Server'
Then the driver executes the heavy query "SELECT * FROM az001.doc101"=2C wh=
ich retrieves about 1.5 million rows.
I came up with a workaround to avoid this problem=2C executing the query=20
SELECT (select count(*) from az001.doc101 where (code=2Criga)=3D(1=2C1))
instead
of the original one=2C but this problem seems to appear in many points of
the application=2C so i would like to find a better solution.
Here are some additional information=2C
the table structure is
CREATE TABLE az001.doc101
(
code integer NOT NULL=2C
riga integer NOT NULL=2C
subriga integer NOT NULL=2C
t_prog character varying(6) NOT NULL=2C
fd_a character varying=2C
fd_nd double precision=2C
fd_il integer=2C
fd_v double precision=2C
fd_d timestamp with time zone=2C
fd_sn boolean NOT NULL DEFAULT false=2C
CONSTRAINT doc101_pkey PRIMARY KEY (code=2C riga=2C subriga=2C t_prog)=2C
CONSTRAINT doc101_code_fkey1 FOREIGN KEY (code=2C riga=2C subriga)
REFERENCES az001.doc110 (code=2C riga=2C subriga) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (OIDS=3DFALSE)=3B
and this is the entire log file:
[0.060]conn=3D02E72C78=2C PGAPI_DriverConnect( in)=3D'DSN=3DPostgreSQL Log=
=3B'=2C fDriverCompletion=3D0
[0.082]DSN info: DSN=3D'PostgreSQL Log'=2Cserver=3D'localhost'=2Cport=3D'54=
32'=2Cdbase=3D'muna'=2Cuser=3D'client'=2Cpasswd=3D'xxxxx'
[0.091] onlyread=3D'0'=2Cprotocol=3D'7.4'=2Cshowoid=3D'0'=2Cfakeoi=
dindex=3D'0'=2Cshowsystable=3D'0'
[0.097] conn_settings=3D''=2C conn_encoding=3D'(null)'
[0.100] translation_dll=3D''=2Ctranslation_option=3D''
[0.116]Driver Version=3D'08.03.0300=2C200809260001' linking 1400 static Mul=
tithread library
[0.123]Global Options: fetch=3D100=2C socket=3D4096=2C unknown_sizes=3D2=2C=
max_varchar_size=3D255=2C max_longvarchar_size=3D8190
[0.131] disable_optimizer=3D0=2C ksqo=3D1=2C unique_index=3D=
1=2C use_declarefetch=3D0
[0.133] text_as_longvarchar=3D1=2C unknowns_as_longvarchar=
=3D0=2C bools_as_char=3D1 NAMEDATALEN=3D64
[0.136] extra_systable_prefixes=3D'dd_=3B'=2C conn_settings=
=3D'' conn_encoding=3D''
[0.544] [ PostgreSQL version string =3D '8.3.4' ]
[0.545] [ PostgreSQL version number =3D '8.3' ]
[0.565]conn=3D02E72C78=2C query=3D'select oid=2C typbasetype from pg_type w=
here typname =3D 'lo''
[0.586] [ fetched 0 rows ]
[0.601] [ Large Object oid =3D -999 ]
[0.602] [ Client encoding =3D 'UTF8' (code =3D 6) ]
[0.613]conn=3D02E72C78=2C
PGAPI_DriverConnect(out)=3D'DSN=3DPostgreSQL
Log=3BDATABASE=3Dmuna=3BSERVER=3Dlocalhost=3BPORT=3D5432=3BU ID=3Dclient=3BP=
WD=3Dxxxxxx=3BSSLmode=3Ddisable=3BReadOnly=3D0=3BProtocol=3D 7.4-1=3BFakeOid=
Index=3D0=3BShowOidColumn=3D0=3BRowVersioning=3D0=3BShowSyst emTables=3D0=3B=
ConnSettings=;Fetch=3D100=3BSocket=3D4096=3BUnknownSizes =3D2=3BMaxVarch=
arSize=3D255=3BMaxLongVarcharSize=3D8190=3BDebug=3D1=3BCommL og=3D1=3BOptimi=
zer=3D0=3BKsqo=3D1=3BUseDeclareFetch=3D0=3BTextAsLongVarchar =3D1=3BUnknowns=
AsLongVarchar=3D0=3BBoolsAsChar=3D1=3BParse=3D0=3BCancelAsFr eeStmt=3D0=3BEx=
traSysTablePrefixes=3Ddd_;;LFConversion=3D1=3BUpdatableC ursors=3D1=3BDi=
sallowPremature=3D0=3BTrueIsMinus1=3D0=3BBI=3D0=3BByteaAsLon gVarBinary=3D1=
=3BUseServerSidePrepare=3D0=3BLowerCaseIdentifier=3D0=3BXaOp t=3D1'
[15.534]conn=3D02E72C78=2C query=3D'select count(*) from az001.doc101 where=
(code=2Criga)=3D(1=2C1)
'
[15.552] [ fetched 1 rows ]
[15.608]conn=3D02E72C78=2C query=3D'show max_identifier_length'
[15.619] [ fetched 1 rows ]
[15.660]STATEMENT ERROR: func=3DPGAPI_ColAttributes=2C desc=3D''=2C errnum=
=3D30=2C errmsg=3D'this request may be for MS SQL Server'
[15.663] --------------------------------------------------=
----------
[15.664] hdbc=3D02E72C78=2C stmt=3D02E77808=2C result=3D02E=
70EA0
[15.665] prepare=3D0=2C internal=3D0
[15.666] bindings=3D02E791E8=2C bindings_allocated=3D1
[15.667] parameters=3D00000000=2C parameters_allocated=3D0
[15.668] statement_type=3D0=2C statement=3D'select count(*)=
from az001.doc101 where (code=2Criga)=3D(1=2C1)
'
[15.670] stmt_with_params=3D'select count(*) from az001.doc=
101 where (code=2Criga)=3D(1=2C1)
'
[15.671] data_at_exec=3D-1=2C current_exec_param=3D-1=2C pu=
t_data=3D0
[15.672] currTuple=3D-1=2C current_col=3D-1=2C lobj_fd=3D-1
[15.673] maxRows=3D0=2C rowset_size=3D1=2C keyset_size=3D0=
=2C cursor_type=3D0=2C scroll_concurrency=3D1
[15.674] cursor_name=3D'SQL_CUR02E77808'
[15.675] ----------------QResult Info ---------------------=
----------
[15.677] fields=3D02E77BA8=2C backend_tuples=3D02E78E70=2C =
tupleField=3D48729712=2C conn=3D02E72C78
[15.678] fetch_count=3D0=2C num_total_rows=3D1=2C num_field=
s=3D1=2C cursor=3D'(NULL)'
[15.679] message=3D'(NULL)'=2C command=3D'SELECT'=2C notice=
=3D'(NULL)'
[15.680] status=3D100=2C inTuples=3D0
[15.681]CONN ERROR: func=3DPGAPI_ColAttributes=2C desc=3D''=2C errnum=3D0=
=2C errmsg=3D'(NULL)'
[15.683] -------------------------------------------------------=
-----
[15.685] henv=3D02E72C38=2C conn=3D02E72C78=2C status=3D1=2C num=
_stmts=3D16
[15.687] sock=3D02E70A08=2C stmts=3D02E70AE0=2C lobj_type=3D-999
[15.688] ---------------- Socket Info --------------------------=
-----
[15.690] socket=3D552=2C reverse=3D0=2C errornumber=3D0=2C error=
msg=3D'(NULL)'
[15.692] buffer_in=3D48715736=2C buffer_out=3D48719856
[15.692] buffer_filled_in=3D76=2C buffer_filled_out=3D0=2C buffe=
r_read_in=3D76
[15.735]CONN ERROR: func=3DSQLNativeSqlW=2C desc=3D''=2C errnum=3D-2=2C err=
msg=3D'Sql string too large'
[15.737] -------------------------------------------------------=
-----
[15.738] henv=3D02E72C38=2C conn=3D02E72C78=2C status=3D1=2C num=
_stmts=3D16
[15.739] sock=3D02E70A08=2C stmts=3D02E70AE0=2C lobj_type=3D-999
[15.740] ---------------- Socket Info --------------------------=
-----
[15.741] socket=3D552=2C reverse=3D0=2C errornumber=3D0=2C error=
msg=3D'(NULL)'
[15.743] buffer_in=3D48715736=2C buffer_out=3D48719856
[15.743] buffer_filled_in=3D76=2C buffer_filled_out=3D0=2C buffe=
r_read_in=3D76
[15.772]conn=3D02E72C78=2C query=3D'SELECT * FROM az001.doc101'
Thanks in advance=2C I apologize for my poor english.
Regards=2C
Moreno Dissegna
Developer
S.A. Software S.r.l.
____________________________________________________________ _____
Pi=F9 di 30 stazioni. Ascolta la Radio su Messenger!
http://messenger.it/radioMessenger.aspx=
--_aa6f7980-0433-4577-a78b-0261d67b5700_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello all=2C
I noticed that after executing a simple query
that takes few milliseconds=2C the odbc driver executes another query
which takes about 30 seconds to execute=2C because it scans a large table.<=
br>This is the part of the log file I think is showing the problem=2C see b=
elow for the entire log file:
[15.534]conn=3D02E72C78=2C query=3D'se=
lect count(*) from az001.doc101 where (code=2Criga)=3D(1=2C1)
'
[15.5=
52] =3B =3B =3B [ fetched 1 rows ]
[15.608]conn=3D02E72C78=
=2C query=3D'show max_identifier_length'
[15.619] =3B =3B =
=3B [ fetched 1 rows ]
[15.660]STATEMENT ERROR: func=3DPGAPI_ColAttribut=
es=2C desc=3D''=2C errnum=3D30=2C errmsg=3D'this request may be for MS SQL =
Server'
Then the driver executes the heavy query "SELECT * FROM az00=
1.doc101"=2C which retrieves about 1.5 million rows.
I came up with =
a workaround to avoid this problem=2C executing the query
SELECT (selec=
t count(*) from az001.doc101 where (code=2Criga)=3D(1=2C1))
instead
of the original one=2C but this problem seems to appear in many points of
the application=2C so i would like to find a better solution.
Here a=
re some additional information=2C
the table structure is
CREATE T=
ABLE az001.doc101
(
 =3B code integer NOT NULL=2C
 =3B rig=
a integer NOT NULL=2C
 =3B subriga integer NOT NULL=2C
 =3B t=
_prog character varying(6) NOT NULL=2C
 =3B fd_a character varying=
=2C
 =3B fd_nd double precision=2C
 =3B fd_il integer=2C
&=
nbsp=3B fd_v double precision=2C
 =3B fd_d timestamp with time zone=
=2C
 =3B fd_sn boolean NOT NULL DEFAULT false=2C
 =3B CONSTRA=
INT doc101_pkey PRIMARY KEY (code=2C riga=2C subriga=2C t_prog)=2C
 =
=3B CONSTRAINT doc101_code_fkey1 FOREIGN KEY (code=2C riga=2C subriga)
&=
nbsp=3B =3B =3B =3B =3B REFERENCES az001.doc110 (code=2C ri=
ga=2C subriga) MATCH SIMPLE
 =3B =3B =3B =3B =3B ON =
UPDATE CASCADE ON DELETE CASCADE
)
WITH (OIDS=3DFALSE)=3B
and =
this is the entire log file:
[0.060]conn=3D02E72C78=2C PGAPI_DriverC=
onnect( in)=3D'DSN=3DPostgreSQL Log=3B'=2C fDriverCompletion=3D0
[0.082]=
DSN info: DSN=3D'PostgreSQL Log'=2Cserver=3D'localhost'=2Cport=3D'5432'=2Cd=
base=3D'muna'=2Cuser=3D'client'=2Cpasswd=3D'xxxxx'
[0.091] =3B =
=3B =3B =3B =3B =3B =3B =3B =3B onlyread=3D'0'=
=2Cprotocol=3D'7.4'=2Cshowoid=3D'0'=2Cfakeoidindex=3D'0'=2Cs howsystable=3D'=
0'
[0.097] =3B =3B =3B =3B =3B =3B  =3B =
=3B =3B conn_settings=3D''=2C conn_encoding=3D'(null)'
[0.100] =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B transla=
tion_dll=3D''=2Ctranslation_option=3D''
[0.116]Driver Version=3D'08.03.0=
300=2C200809260001' linking 1400 static Multithread library
[0.123]Globa=
l Options: fetch=3D100=2C socket=3D4096=2C unknown_sizes=3D2=2C max_varchar=
_size=3D255=2C max_longvarchar_size=3D8190
[0.131] =3B =3B =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B =3B =3B disable_optimizer=3D0=2C ksqo=3D1=2C unique_index=
=3D1=2C use_declarefetch=3D0
[0.133] =3B =3B =3B =3B&nbs=
p=3B =3B =3B =3B =3B =3B =3B =3B  =3B =
=3B =3B text_as_longvarchar=3D1=2C unknowns_as_longvarchar=3D0=2C bools=
_as_char=3D1 NAMEDATALEN=3D64
[0.136] =3B =3B =3B =3B&nb=
sp=3B =3B =3B =3B =3B =3B =3B =3 B =3B =
=3B =3B extra_systable_prefixes=3D'dd_=3B'=2C conn_settings=3D'' conn_e=
ncoding=3D''
[0.544] =3B =3B =3B [ PostgreSQL version string=
=3D '8.3.4' ]
[0.545] =3B =3B =3B [ PostgreSQL version numb=
er =3D '8.3' ]
[0.565]conn=3D02E72C78=2C query=3D'select oid=2C typbaset=
ype from pg_type where typname =3D 'lo''
[0.586] =3B =3B =3B=
[ fetched 0 rows ]
[0.601] =3B =3B =3B [ Large Object oid =
=3D -999 ]
[0.602] =3B =3B =3B [ Client encoding =3D 'UTF8' =
(code =3D 6) ]
[0.613]conn=3D02E72C78=2C
PGAPI_DriverConnect(out)=3D'DSN=3DPostgreSQL
Log=3BDATABASE=3Dmuna=3BSERVER=3Dlocalhost=3BPORT=3D5432=3BU ID=3Dclient=3BP=
WD=3Dxxxxxx=3BSSLmode=3Ddisable=3BReadOnly=3D0=3BProtocol=3D 7.4-1=3BFakeOid=
Index=3D0=3BShowOidColumn=3D0=3BRowVersioning=3D0=3BShowSyst emTables=3D0=3B=
ConnSettings=;Fetch=3D100=3BSocket=3D4096=3BUnknownSizes =3D2=3BMaxVarch=
arSize=3D255=3BMaxLongVarcharSize=3D8190=3BDebug=3D1=3BCommL og=3D1=3BOptimi=
zer=3D0=3BKsqo=3D1=3BUseDeclareFetch=3D0=3BTextAsLongVarchar =3D1=3BUnknowns=
AsLongVarchar=3D0=3BBoolsAsChar=3D1=3BParse=3D0=3BCancelAsFr eeStmt=3D0=3BEx=
traSysTablePrefixes=3Ddd_;;LFConversion=3D1=3BUpdatableC ursors=3D1=3BDi=
sallowPremature=3D0=3BTrueIsMinus1=3D0=3BBI=3D0=3BByteaAsLon gVarBinary=3D1=
=3BUseServerSidePrepare=3D0=3BLowerCaseIdentifier=3D0=3BXaOp t=3D1'
[15.5=
34]conn=3D02E72C78=2C query=3D'select count(*) from az001.doc101 where (cod=
e=2Criga)=3D(1=2C1)
'
[15.552] =3B =3B =3B [ fetched 1 ro=
ws ]
[15.608]conn=3D02E72C78=2C query=3D'show max_identifier_length'
=
[15.619] =3B =3B =3B [ fetched 1 rows ]
[15.660]STATEMENT ER=
ROR: func=3DPGAPI_ColAttributes=2C desc=3D''=2C errnum=3D30=2C errmsg=3D'th=
is request may be for MS SQL Server'
[15.663] =3B =3B =3B&nb=
sp=3B =3B =3B =3B =3B =3B =3B =3 B =3B =
=3B =3B =3B =3B -----------------------------------------------=
-------------
[15.664] =3B =3B =3B =3B =3B =3B&n=
bsp=3B =3B =3B =3B =3B =3B =3B = 3B =3B =
=3B hdbc=3D02E72C78=2C stmt=3D02E77808=2C result=3D02E70EA0
[15.665]&nbs=
p=3B =3B =3B =3B =3B =3B =3B =3B  =3B =
=3B =3B =3B =3B =3B =3B =3B prepare=3D0=2C internal=
=3D0
[15.666] =3B =3B =3B =3B =3B =3B&nbs p=3B&nb=
sp=3B =3B =3B =3B =3B =3B =3B =3 B =3B bindi=
ngs=3D02E791E8=2C bindings_allocated=3D1
[15.667] =3B =3B =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B =3B =3B =3B parameters=3D00000000=2C parameters_alloca=
ted=3D0
[15.668] =3B =3B =3B =3B =3B =3B&nbs p=3B=
 =3B =3B =3B =3B =3B =3B =3B&nbs p=3B =3B st=
atement_type=3D0=2C statement=3D'select count(*) from az001.doc101 where (c=
ode=2Criga)=3D(1=2C1)
'
[15.670] =3B =3B =3B =3B =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B =3B stmt_with_params=3D'select count(*) from az001.doc101 wher=
e (code=2Criga)=3D(1=2C1)
'
[15.671] =3B =3B =3B =3B&=
nbsp=3B =3B =3B =3B =3B =3B =3B  =3B =3B&nbs=
p=3B =3B =3B data_at_exec=3D-1=2C current_exec_param=3D-1=2C put_da=
ta=3D0
[15.672] =3B =3B =3B =3B =3B =3B&nbs p=3B&=
nbsp=3B =3B =3B =3B =3B =3B =3B  =3B =3B cur=
rTuple=3D-1=2C current_col=3D-1=2C lobj_fd=3D-1
[15.673] =3B =3B=
 =3B =3B =3B =3B =3B =3B =3B&nbs p=3B =3B&nb=
sp=3B =3B =3B =3B =3B maxRows=3D0=2C rowset_size=3D1=2C key=
set_size=3D0=2C cursor_type=3D0=2C scroll_concurrency=3D1
[15.674] =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B =3B =3B =3B =3B =3B cursor_name=3D'SQL_CUR02E7=
7808'
[15.675] =3B =3B =3B =3B =3B =3B&nbs p=3B&n=
bsp=3B =3B =3B =3B =3B =3B =3B = 3B =3B ----=
------------QResult Info -------------------------------
[15.677] =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B =3B =3B =3B =3B =3B fields=3D02E77BA8=2C backe=
nd_tuples=3D02E78E70=2C tupleField=3D48729712=2C conn=3D02E72C78
[15.678=
] =3B =3B =3B =3B =3B =3B =3B&nb sp=3B =3B&n=
bsp=3B =3B =3B =3B =3B =3B =3B fetch_count=3D0=2C n=
um_total_rows=3D1=2C num_fields=3D1=2C cursor=3D'(NULL)'
[15.679] =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B =3B =3B =3B =3B =3B message=3D'(NULL)'=2C comm=
and=3D'SELECT'=2C notice=3D'(NULL)'
[15.680] =3B =3B =3B&nbs=
p=3B =3B =3B =3B =3B =3B =3B =3B  =3B =
=3B =3B =3B =3B status=3D100=2C inTuples=3D0
[15.681]CONN ER=
ROR: func=3DPGAPI_ColAttributes=2C desc=3D''=2C errnum=3D0=2C errmsg=3D'(NU=
LL)'
[15.683] =3B =3B =3B =3B =3B =3B&nbs p=3B&nb=
sp=3B =3B =3B =3B ---------------------------------------------=
---------------
[15.685] =3B =3B =3B =3B =3B =3B=
 =3B =3B =3B =3B =3B henv=3D02E72C38=2C conn=3D02E72C78=
=2C status=3D1=2C num_stmts=3D16
[15.687] =3B =3B =3B =
=3B =3B =3B =3B =3B =3B =3B =3B sock=3D02E70A08=
=2C stmts=3D02E70AE0=2C lobj_type=3D-999
[15.688] =3B =3B =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B -------=
--------- Socket Info -------------------------------
[15.690] =3B&n=
bsp=3B =3B =3B =3B =3B =3B =3B = 3B =3B =
=3B socket=3D552=2C reverse=3D0=2C errornumber=3D0=2C errormsg=3D'(NULL)' r>[15.692] =3B =3B =3B =3B =3B =3B&n bsp=3B =3B&=
nbsp=3B =3B =3B buffer_in=3D48715736=2C buffer_out=3D48719856
[1=
5.692] =3B =3B =3B =3B =3B =3B = 3B =3B =
=3B =3B =3B buffer_filled_in=3D76=2C buffer_filled_out=3D0=2C buffe=
r_read_in=3D76
[15.735]CONN ERROR: func=3DSQLNativeSqlW=2C desc=3D''=2C =
errnum=3D-2=2C errmsg=3D'Sql string too large'
[15.737] =3B =3B&=
nbsp=3B =3B =3B =3B =3B =3B =3B  =3B =3B ---=
---------------------------------------------------------
[15.738] =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B =3B=
 =3B henv=3D02E72C38=2C conn=3D02E72C78=2C status=3D1=2C num_stmts=3D16=
[15.739] =3B =3B =3B =3B =3B =3B&nbs p=3B =
=3B =3B =3B =3B sock=3D02E70A08=2C stmts=3D02E70AE0=2C lobj_typ=
e=3D-999
[15.740] =3B =3B =3B =3B =3B =3B&nbs p=
=3B =3B =3B =3B =3B ---------------- Socket Info ----------=
---------------------
[15.741] =3B =3B =3B =3B =3B&n=
bsp=3B =3B =3B =3B =3B =3B socket=3D552=2C reverse=3D0=
=2C errornumber=3D0=2C errormsg=3D'(NULL)'
[15.743] =3B =3B =
=3B =3B =3B =3B =3B =3B =3B =3B& nbsp=3B buffer_=
in=3D48715736=2C buffer_out=3D48719856
[15.743] =3B =3B =3B&=
nbsp=3B =3B =3B =3B =3B =3B =3B  =3B buffer_fill=
ed_in=3D76=2C buffer_filled_out=3D0=2C buffer_read_in=3D76
[15.772]conn=
=3D02E72C78=2C query=3D'SELECT * FROM az001.doc101'
Thanks in ad=
vance=2C I apologize for my poor english.
Regards=2C
Moreno D=
issegna
Developer
S.A. Software S.r.l.
Scrivi=2C parla e g=
ioca con i tuoi amici! '_new'>Scarica Messenger 2009!
=
--_aa6f7980-0433-4577-a78b-0261d67b5700_--