Show max_identifier_length causes heavy query execution

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_--

Re: Show max_identifier_length causes heavy query execution

am 26.05.2009 22:25:53 von Ken Sell

--_000_C6419E611F0ksellgreenplumcom_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I'm the new connectivity engineer.

I'm attempting to recreate the problem, but haven't seen the same results a=
s you.
Can you send me the sequence of ODBC statements that cause the problem?

Thanks,

.....Ken Sell


On 5/26/09 9:48 AM, "Moreno D." wrote:

Hello all,

I noticed that after executing a simple query that takes few milliseconds, =
the odbc driver executes another query which takes about 30 seconds to exec=
ute, because it scans a large table.
This is the part of the log file I think is showing the problem, see below =
for the entire log file:

[15.534]conn=3D02E72C78, query=3D'select count(*) from az001.doc101 where (=
code,riga)=3D(1,1)
'
[15.552] [ fetched 1 rows ]
[15.608]conn=3D02E72C78, query=3D'show max_identifier_length'
[15.619] [ fetched 1 rows ]
[15.660]STATEMENT ERROR: func=3DPGAPI_ColAttributes, desc=3D'', errnum=3D30=
, errmsg=3D'this request may be for MS SQL Server'

Then the driver executes the heavy query "SELECT * FROM az001.doc101", whic=
h retrieves about 1.5 million rows.

I came up with a workaround to avoid this problem, executing the query
SELECT (select count(*) from az001.doc101 where (code,riga)=3D(1,1))
instead of the original one, but this problem seems to appear in many point=
s of the application, so i would like to find a better solution.

Here are some additional information,
the table structure is

CREATE TABLE az001.doc101
(
code integer NOT NULL,
riga integer NOT NULL,
subriga integer NOT NULL,
t_prog character varying(6) NOT NULL,
fd_a character varying,
fd_nd double precision,
fd_il integer,
fd_v double precision,
fd_d timestamp with time zone,
fd_sn boolean NOT NULL DEFAULT false,
CONSTRAINT doc101_pkey PRIMARY KEY (code, riga, subriga, t_prog),
CONSTRAINT doc101_code_fkey1 FOREIGN KEY (code, riga, subriga)
REFERENCES az001.doc110 (code, riga, subriga) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (OIDS=3DFALSE);

and this is the entire log file:

[0.060]conn=3D02E72C78, PGAPI_DriverConnect( in)=3D'DSN=3DPostgreSQL Log;',=
fDriverCompletion=3D0
[0.082]DSN info: DSN=3D'PostgreSQL Log',server=3D'localhost',port=3D'5432',=
dbase=3D'muna',user=3D'client',passwd=3D'xxxxx'
[0.091] onlyread=3D'0',protocol=3D'7.4',showoid=3D'0',fakeoidindex=
=3D'0',showsystable=3D'0'
[0.097] conn_settings=3D'', conn_encoding=3D'(null)'
[0.100] translation_dll=3D'',translation_option=3D''
[0.116]Driver Version=3D'08.03.0300,200809260001' linking 1400 static Multi=
thread library
[0.123]Global Options: fetch=3D100, socket=3D4096, unknown_sizes=3D2, max_v=
archar_size=3D255, max_longvarchar_size=3D8190
[0.131] disable_optimizer=3D0, ksqo=3D1, unique_index=3D1, u=
se_declarefetch=3D0
[0.133] text_as_longvarchar=3D1, unknowns_as_longvarchar=3D0=
, bools_as_char=3D1 NAMEDATALEN=3D64
[0.136] extra_systable_prefixes=3D'dd_;', 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, query=3D'select oid, typbasetype from pg_type where=
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, PGAPI_DriverConnect(out)=3D'DSN=3DPostgreSQL Log;DA=
TABASE=3Dmuna;SERVER=3Dlocalhost;PORT=3D5432;UID=3Dclient;PW D=3Dxxxxxx;SSLm=
ode=3Ddisable;ReadOnly=3D0;Protocol=3D7.4-1;FakeOidIndex=3D0 ;ShowOidColumn=
=3D0;RowVersioning=3D0;ShowSystemTables=3D0;ConnSettings=3D; Fetch=3D100;Soc=
ket=3D4096;UnknownSizes=3D2;MaxVarcharSize=3D255;MaxLongVarc harSize=3D8190;=
Debug=3D1;CommLog=3D1;Optimizer=3D0;Ksqo=3D1;UseDeclareFetch =3D0;TextAsLong=
Varchar=3D1;UnknownsAsLongVarchar=3D0;BoolsAsChar=3D1;Parse= 3D0;CancelAsFre=
eStmt=3D0;ExtraSysTablePrefixes=3Ddd_;;LFConversion=3D1;Upda tableCursors=3D=
1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongV arBinary=3D1;Us=
eServerSidePrepare=3D0;LowerCaseIdentifier=3D0;XaOpt=3D1'
[15.534]conn=3D02E72C78, query=3D'select count(*) from az001.doc101 where (=
code,riga)=3D(1,1)
'
[15.552] [ fetched 1 rows ]
[15.608]conn=3D02E72C78, query=3D'show max_identifier_length'
[15.619] [ fetched 1 rows ]
[15.660]STATEMENT ERROR: func=3DPGAPI_ColAttributes, desc=3D'', errnum=3D30=
, errmsg=3D'this request may be for MS SQL Server'
[15.663] --------------------------------------------------=
----------
[15.664] hdbc=3D02E72C78, stmt=3D02E77808, result=3D02E70EA=
0
[15.665] prepare=3D0, internal=3D0
[15.666] bindings=3D02E791E8, bindings_allocated=3D1
[15.667] parameters=3D00000000, parameters_allocated=3D0
[15.668] statement_type=3D0, statement=3D'select count(*) f=
rom az001.doc101 where (code,riga)=3D(1,1)
'
[15.670] stmt_with_params=3D'select count(*) from az001.doc=
101 where (code,riga)=3D(1,1)
'
[15.671] data_at_exec=3D-1, current_exec_param=3D-1, put_da=
ta=3D0
[15.672] currTuple=3D-1, current_col=3D-1, lobj_fd=3D-1
[15.673] maxRows=3D0, rowset_size=3D1, keyset_size=3D0, cur=
sor_type=3D0, scroll_concurrency=3D1
[15.674] cursor_name=3D'SQL_CUR02E77808'
[15.675] ----------------QResult Info ---------------------=
----------
[15.677] fields=3D02E77BA8, backend_tuples=3D02E78E70, tupl=
eField=3D48729712, conn=3D02E72C78
[15.678] fetch_count=3D0, num_total_rows=3D1, num_fields=3D=
1, cursor=3D'(NULL)'
[15.679] message=3D'(NULL)', command=3D'SELECT', notice=3D'=
(NULL)'
[15.680] status=3D100, inTuples=3D0
[15.681]CONN ERROR: func=3DPGAPI_ColAttributes, desc=3D'', errnum=3D0, errm=
sg=3D'(NULL)'
[15.683] -------------------------------------------------------=
-----
[15.685] henv=3D02E72C38, conn=3D02E72C78, status=3D1, num_stmts=
=3D16
[15.687] sock=3D02E70A08, stmts=3D02E70AE0, lobj_type=3D-999
[15.688] ---------------- Socket Info --------------------------=
-----
[15.690] socket=3D552, reverse=3D0, errornumber=3D0, errormsg=3D=
'(NULL)'
[15.692] buffer_in=3D48715736, buffer_out=3D48719856
[15.692] buffer_filled_in=3D76, buffer_filled_out=3D0, buffer_re=
ad_in=3D76
[15.735]CONN ERROR: func=3DSQLNativeSqlW, desc=3D'', errnum=3D-2, errmsg=3D=
'Sql string too large'
[15.737] -------------------------------------------------------=
-----
[15.738] henv=3D02E72C38, conn=3D02E72C78, status=3D1, num_stmts=
=3D16
[15.739] sock=3D02E70A08, stmts=3D02E70AE0, lobj_type=3D-999
[15.740] ---------------- Socket Info --------------------------=
-----
[15.741] socket=3D552, reverse=3D0, errornumber=3D0, errormsg=3D=
'(NULL)'
[15.743] buffer_in=3D48715736, buffer_out=3D48719856
[15.743] buffer_filled_in=3D76, buffer_filled_out=3D0, buffer_re=
ad_in=3D76
[15.772]conn=3D02E72C78, query=3D'SELECT * FROM az001.doc101'


Thanks in advance, I apologize for my poor english.

Regards,

Moreno Dissegna
Developer
S.A. Software S.r.l.
________________________________
Scrivi, parla e gioca con i tuoi amici! Scarica Messenger 2009! senger.it/gioca.aspx>

--_000_C6419E611F0ksellgreenplumcom_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



Re: [ODBC] Show max_identifier_length causes heavy query execution</=<br /> TITLE><br /> </HEAD><br /> <BODY><br /> <FONT FACE=3D"Calibri, Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:=<br /> 11pt'>Hi,<BR><br /> <BR><br /> I’m the new connectivity engineer.<BR><br /> <BR><br /> I’m attempting to recreate the problem, but haven’t seen the sa=<br /> me results as you.<BR><br /> Can you send me the sequence of ODBC statements that cause the problem?<BR><br /> <BR><br /> Thanks,<BR><br /> <BR><br /> .....Ken Sell<BR><br /> <BR><br /> <BR><br /> On 5/26/09 9:48 AM, "Moreno D." <<a href=3D"moreno.d@hotmail.i=<br /> t">moreno.d@hotmail.it</a>> wrote:<BR><br /> <BR><br /> </SPAN></FONT><BLOCKQUOTE><FONT SIZE=3D"2"><FONT FACE=3D"Verdana, Helvetica=<br /> , Arial"><SPAN STYLE=3D'font-size:10pt'>Hello all,<BR><br /> <BR><br /> I noticed that after executing a simple query that takes few milliseconds, =<br /> the odbc driver executes another query which takes about 30 seconds to exec=<br /> ute, because it scans a large table.<BR><br /> This is the part of the log file I think is showing the problem, see below =<br /> for the entire log file:<BR><br /> <BR><br /> [15.534]conn=3D02E72C78, query=3D'select count(*) from az001.doc101 where (=<br /> code,riga)=3D(1,1)<BR><br /> '<BR><br /> [15.552]    [ fetched 1 rows ]<BR><br /> [15.608]conn=3D02E72C78, query=3D'show max_identifier_length'<BR><br /> [15.619]    [ fetched 1 rows ]<BR><br /> [15.660]STATEMENT ERROR: func=3DPGAPI_ColAttributes, desc=3D'', errnum=3D30=<br /> , errmsg=3D'this request may be for MS SQL Server'<BR><br /> <BR><br /> Then the driver executes the heavy query "SELECT * FROM az001.doc101&q=<br /> uot;, which retrieves about 1.5 million rows.<BR><br /> <BR><br /> I came up with a workaround to avoid this problem, executing the query <BR><br /> SELECT (select count(*) from az001.doc101 where (code,riga)=3D(1,1))<BR><br /> instead of the original one, but this problem seems to appear in many point=<br /> s of the application, so i would like to find a better solution.<BR><br /> <BR><br /> Here are some additional information,<BR><br /> the table structure is<BR><br /> <BR><br /> CREATE TABLE az001.doc101<BR><br /> (<BR><br />   code integer NOT NULL,<BR><br />   riga integer NOT NULL,<BR><br />   subriga integer NOT NULL,<BR><br />   t_prog character varying(6) NOT NULL,<BR><br />   fd_a character varying,<BR><br />   fd_nd double precision,<BR><br />   fd_il integer,<BR><br />   fd_v double precision,<BR><br />   fd_d timestamp with time zone,<BR><br />   fd_sn boolean NOT NULL DEFAULT false,<BR><br />   CONSTRAINT doc101_pkey PRIMARY KEY (code, riga, subriga, t_prog=<br /> ),<BR><br />   CONSTRAINT doc101_code_fkey1 FOREIGN KEY (code, riga, subriga)<=<br /> BR><br />       REFERENCES az001.doc110 (code, riga, su=<br /> briga) MATCH SIMPLE<BR><br />       ON UPDATE CASCADE ON DELETE CASCADE<BR><br /> )<BR><br /> WITH (OIDS=3DFALSE);<BR><br /> <BR><br /> and this is the entire log file:<BR><br /> <BR><br /> [0.060]conn=3D02E72C78, PGAPI_DriverConnect( in)=3D'DSN=3DPostgreSQL Log;',=<br /> fDriverCompletion=3D0<BR><br /> [0.082]DSN info: DSN=3D'PostgreSQL Log',server=3D'localhost',port=3D'5432',=<br /> dbase=3D'muna',user=3D'client',passwd=3D'xxxxx'<BR><br /> [0.091]          onlyread=3D'0=<br /> ',protocol=3D'7.4',showoid=3D'0',fakeoidindex=3D'0',showsyst able=3D'0'<BR><br /> [0.097]          conn_settings=<br /> =3D'', conn_encoding=3D'(null)'<BR><br /> [0.100]          translation_d=<br /> ll=3D'',translation_option=3D''<BR><br /> [0.116]Driver Version=3D'08.03.0300,200809260001' linking 1400 static Multi=<br /> thread library<BR><br /> [0.123]Global Options: fetch=3D100, socket=3D4096, unknown_sizes=3D2, max_v=<br /> archar_size=3D255, max_longvarchar_size=3D8190<BR><br /> [0.131]            &=<br /> nbsp;   disable_optimizer=3D0, ksqo=3D1, unique_index=3D1, u=<br /> se_declarefetch=3D0<BR><br /> [0.133]            &=<br /> nbsp;   text_as_longvarchar=3D1, unknowns_as_longvarchar=3D0=<br /> , bools_as_char=3D1 NAMEDATALEN=3D64<BR><br /> [0.136]            &=<br /> nbsp;   extra_systable_prefixes=3D'dd_;', conn_settings=3D''=<br /> conn_encoding=3D''<BR><br /> [0.544]    [ PostgreSQL version string =3D '8.3.4' ]<BR><br /> [0.545]    [ PostgreSQL version number =3D '8.3' ]<BR><br /> [0.565]conn=3D02E72C78, query=3D'select oid, typbasetype from pg_type where=<br /> typname =3D 'lo''<BR><br /> [0.586]    [ fetched 0 rows ]<BR><br /> [0.601]    [ Large Object oid =3D -999 ]<BR><br /> [0.602]    [ Client encoding =3D 'UTF8' (code =3D 6) ]<BR><br /> [0.613]conn=3D02E72C78, PGAPI_DriverConnect(out)=3D'DSN=3DPostgreSQL Log;DA=<br /> TABASE=3Dmuna;SERVER=3Dlocalhost;PORT=3D5432;UID=3Dclient;PW D=3Dxxxxxx;SSLm=<br /> ode=3Ddisable;ReadOnly=3D0;Protocol=3D7.4-1;FakeOidIndex=3D0 ;ShowOidColumn=<br /> =3D0;RowVersioning=3D0;ShowSystemTables=3D0;ConnSettings=3D; Fetch=3D100;Soc=<br /> ket=3D4096;UnknownSizes=3D2;MaxVarcharSize=3D255;MaxLongVarc harSize=3D8190;=<br /> Debug=3D1;CommLog=3D1;Optimizer=3D0;Ksqo=3D1;UseDeclareFetch =3D0;TextAsLong=<br /> Varchar=3D1;UnknownsAsLongVarchar=3D0;BoolsAsChar=3D1;Parse= 3D0;CancelAsFre=<br /> eStmt=3D0;ExtraSysTablePrefixes=3Ddd_;;LFConversion=3D1;Upda tableCursors=3D=<br /> 1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongV arBinary=3D1;Us=<br /> eServerSidePrepare=3D0;LowerCaseIdentifier=3D0;XaOpt=3D1'<BR><br /> [15.534]conn=3D02E72C78, query=3D'select count(*) from az001.doc101 where (=<br /> code,riga)=3D(1,1)<BR><br /> '<BR><br /> [15.552]    [ fetched 1 rows ]<BR><br /> [15.608]conn=3D02E72C78, query=3D'show max_identifier_length'<BR><br /> [15.619]    [ fetched 1 rows ]<BR><br /> [15.660]STATEMENT ERROR: func=3DPGAPI_ColAttributes, desc=3D'', errnum=3D30=<br /> , errmsg=3D'this request may be for MS SQL Server'<BR><br /> [15.663]            =<br />      ---------------------------------------------=<br /> ---------------<BR><br /> [15.664]            =<br />      hdbc=3D02E72C78, stmt=3D02E77808, result=3D02=<br /> E70EA0<BR><br /> [15.665]            =<br />      prepare=3D0, internal=3D0<BR><br /> [15.666]            =<br />      bindings=3D02E791E8, bindings_allocated=3D1<B=<br /> R><br /> [15.667]            =<br />      parameters=3D00000000, parameters_allocated=<br /> =3D0<BR><br /> [15.668]            =<br />      statement_type=3D0, statement=3D'select count=<br /> (*) from az001.doc101 where (code,riga)=3D(1,1)<BR><br /> '<BR><br /> [15.670]            =<br />      stmt_with_params=3D'select count(*) from az00=<br /> 1.doc101 where (code,riga)=3D(1,1)<BR><br /> '<BR><br /> [15.671]            =<br />      data_at_exec=3D-1, current_exec_param=3D-1, p=<br /> ut_data=3D0<BR><br /> [15.672]            =<br />      currTuple=3D-1, current_col=3D-1, lobj_fd=3D-=<br /> 1<BR><br /> [15.673]            =<br />      maxRows=3D0, rowset_size=3D1, keyset_size=3D0=<br /> , cursor_type=3D0, scroll_concurrency=3D1<BR><br /> [15.674]            =<br />      cursor_name=3D'SQL_CUR02E77808'<BR><br /> [15.675]            =<br />      ----------------QResult Info ----------------=<br /> ---------------<BR><br /> [15.677]            =<br />      fields=3D02E77BA8, backend_tuples=3D02E78E70,=<br /> tupleField=3D48729712, conn=3D02E72C78<BR><br /> [15.678]            =<br />      fetch_count=3D0, num_total_rows=3D1, num_fiel=<br /> ds=3D1, cursor=3D'(NULL)'<BR><br /> [15.679]            =<br />      message=3D'(NULL)', command=3D'SELECT', notic=<br /> e=3D'(NULL)'<BR><br /> [15.680]            =<br />      status=3D100, inTuples=3D0<BR><br /> [15.681]CONN ERROR: func=3DPGAPI_ColAttributes, desc=3D'', errnum=3D0, errm=<br /> sg=3D'(NULL)'<BR><br /> [15.683]            =<br /> ------------------------------------------------------------<BR><br /> [15.685]            =<br /> henv=3D02E72C38, conn=3D02E72C78, status=3D1, num_stmts=3D16<BR><br /> [15.687]            =<br /> sock=3D02E70A08, stmts=3D02E70AE0, lobj_type=3D-999<BR><br /> [15.688]            =<br /> ---------------- Socket Info -------------------------------<BR><br /> [15.690]            =<br /> socket=3D552, reverse=3D0, errornumber=3D0, errormsg=3D'(NULL)'<BR><br /> [15.692]            =<br /> buffer_in=3D48715736, buffer_out=3D48719856<BR><br /> [15.692]            =<br /> buffer_filled_in=3D76, buffer_filled_out=3D0, buffer_read_in=3D76<BR><br /> [15.735]CONN ERROR: func=3DSQLNativeSqlW, desc=3D'', errnum=3D-2, errmsg=3D=<br /> 'Sql string too large'<BR><br /> [15.737]            =<br /> ------------------------------------------------------------<BR><br /> [15.738]            =<br /> henv=3D02E72C38, conn=3D02E72C78, status=3D1, num_stmts=3D16<BR><br /> [15.739]            =<br /> sock=3D02E70A08, stmts=3D02E70AE0, lobj_type=3D-999<BR><br /> [15.740]            =<br /> ---------------- Socket Info -------------------------------<BR><br /> [15.741]            =<br /> socket=3D552, reverse=3D0, errornumber=3D0, errormsg=3D'(NULL)'<BR><br /> [15.743]            =<br /> buffer_in=3D48715736, buffer_out=3D48719856<BR><br /> [15.743]            =<br /> buffer_filled_in=3D76, buffer_filled_out=3D0, buffer_read_in=3D76<BR><br /> [15.772]conn=3D02E72C78, query=3D'SELECT * FROM az001.doc101'<BR><br /> <BR><br /> <BR><br /> Thanks in advance, I apologize for my poor english.<BR><br /> <BR><br /> Regards,<BR><br /> <BR><br /> Moreno Dissegna<BR><br /> Developer<BR><br /> S.A. Software S.r.l.<BR><br /> <HR ALIGN=3DCENTER SIZE=3D"3" WIDTH=3D"100%">Scrivi, parla e gioca con i tu=<br /> oi amici! Scarica Messenger 2009! <<a href=3D"http://messenger.it/gioca.=<br /> aspx">http://messenger.it/gioca.aspx</a>> <BR><br /> </SPAN></FONT></FONT></BLOCKQUOTE><br /> </BODY><br /> </HTML><br /> <br /> <br /> --_000_C6419E611F0ksellgreenplumcom_--</p> </article> <article> <h2>Re: Show max_identifier_length causes heavy query execution</h2><span>am 27.05.2009 09:16:58 von Albe Laurenz</span> <p>Moreno D. wrote:<br /> > I noticed that after executing a simple query that takes few=20<br /> > milliseconds, the odbc driver executes another query which=20<br /> > takes about 30 seconds to execute, because it scans a large table.<br /> ><br /> [...]<br /> >=20<br /> > Then the driver executes the heavy query "SELECT * FROM=20<br /> > az001.doc101", which retrieves about 1.5 million rows.<br /> >=20<br /> [...]<br /> >=20<br /> > and this is the entire log file:<br /> >=20<br /> [...]<br /> > [0.613]conn=3D02E72C78,=20<br /> > PGAPI_DriverConnect(out)=3D'DSN=3DPostgreSQL=20<br /> > Log;DATABASE=3Dmuna;SERVER=3Dlocalhost;PORT=3D5432;UID=3Dcli ent;PWD=3Dxx<br /> > xxxx;SSLmode=3Ddisable;ReadOnly=3D0;Protocol=3D7.4-1;FakeOid Index=3D0;<br /> > ShowOidColumn=3D0;RowVersioning=3D0;ShowSystemTables=3D0;Con nSetting<br /> > s=3D;Fetch=3D100;Socket=3D4096;UnknownSizes=3D2;MaxVarcharSi ze=3D255;Max<br /> > LongVarcharSize=3D8190;Debug=3D1;CommLog=3D1;Optimizer=3D0;K sqo=3D1;UseD<br /> > eclareFetch=3D0;TextAsLongVarchar=3D1;UnknownsAsLongVarchar= 3D0;Bool<br /> > sAsChar=3D1;Parse=3D0;CancelAsFreeStmt=3D0;ExtraSysTablePref ixes=3Ddd_<br /> > ;;LFConversion=3D1;UpdatableCursors=3D1;DisallowPremature=3D 0;TrueIs<br /> > Minus1=3D0;BI=3D0;ByteaAsLongVarBinary=3D1;UseServerSidePrep are=3D0;Lo<br /> > werCaseIdentifier=3D0;XaOpt=3D1'<br /> <br /> Without the ODBC statements it is difficult to say something conclusive,<br /> but it *might* be that you have the same problem I had some time ago.<br /> <br /> I see that you set "Parse=3D0" in your connection options.<br /> This will result in the ODBC driver executing "SELECT *"-Statements<br /> when it needs to get a column description.<br /> <br /> If that is the cause of your problem, then setting "Parse=3D1"<br /> will fix it.<br /> <br /> In ODBC Administrator on Windows, this option is called "Parse Statements"<br /> and can be found in the advanced options page 1 (Button "Datasource").<br /> <br /> Yours,<br /> Laurenz Albe<br /> <br /> --=20<br /> Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)<br /> To make changes to your subscription:<br /> http://www.postgresql.org/mailpref/pgsql-odbc</p> </article> <article> <h2>Re: Show max_identifier_length causes heavy query execution</h2><span>am 28.05.2009 15:42:52 von moreno.d</span> <p>>If that is the cause of your problem, then setting "Parse=3D1"<br /> >will fix it.<br /> >=20<br /> >In ODBC Administrator on Windows, this option is called "Parse Statements"<br /> >and can be found in the advanced options page 1 (Button "Datasource").<br /> <br /> Thank you Laurenz, setting "Parse=3D1" solved my problem!<br /> Anyway, another problem appeared at another point in the application, i thi=<br /> nk this is the reason why that flag was turned off.<br /> I simplified the query that gives the error, and obtained this :<br /> <br /> SELECT 1 as prog UNION SELECT code from aaa; --This one gives error<br /> <br /> where aaa is a previously created table (If I create the table in the same =<br /> statement, I don't get the error) :<br /> <br /> create table aaa(<br /> code integer -- i tried also with character varying, it's the same<br /> );<br /> <br /> If I write the two select in reverse order it works<br /> <br /> SELECT code as prog from aaa UNION SELECT 1; --This one works<br /> <br /> >Without the ODBC statements it is difficult to say something conclusive,<br /> <br /> I attach below the log file, but I don't know what are the "ODBC statements=<br /> "...Is it the "mylog" file? I'm using ADO components to connect to the data=<br /> base, so I don't know very much about ODBC, I'm sorry..<br /> <br /> I analized the mylog in both cases and noticed this difference:<br /> <br /> (This is the correct one)<br /> [2956-2.138]parse_statement: entering...<br /> [2956-2.138]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'SELECT', ptr=3D'code as prog from aaa UNION SELECT 1;<br /> '<br /> [2956-2.140]SELECT<br /> [2956-2.140]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'code', ptr=3D'as prog from aaa UNION SELECT 1;<br /> '<br /> [2956-2.142]blevel=3D0 btoken=3DSELECT in_dot=3D0 in_field=3D0 tbname=3D<br /> [2956-2.143]reallocing at nfld=3D0<br /> [2956-2.144]got field=3D'code', dot=3D'(null)'<br /> [2956-2.144]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'as', ptr=3D'prog from aaa UNION SELECT 1;<br /> '<br /> [2956-2.146]blevel=3D0 btoken=3Dcode in_dot=3D0 in_field=3D1 tbname=3D<br /> [2956-2.147]got AS<br /> [2956-2.147]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'prog', ptr=3D'from aaa UNION SELECT 1;<br /> '<br /> [2956-2.149]blevel=3D0 btoken=3Das in_dot=3D0 in_field=3D1 tbname=3D<br /> [2956-2.149]alias for field 'code' is 'prog'<br /> [2956-2.150]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'from', ptr=3D'aaa UNION SELECT 1;<br /> '<br /> [2956-2.152]First [2956-2.152]FROM<br /> [2956-2.152]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'aaa', ptr=3D'UNION SELECT 1;<br /> '<br /> [2956-2.153]got table =3D 'aaa'<br /> [2956-2.154]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'UNION', ptr=3D'SELECT 1;<br /> '<br /> [2956-2.155]UNION... <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<=<br /> <<<<<<=20<br /> <br /> (And this is the one that gives error)<br /> [3244-1.937]parse_statement: entering...<br /> [3244-1.937]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'SELECT', ptr=3D'1 as prog UNION SELECT code from aaa;<br /> '<br /> [3244-1.939]SELECT<br /> [3244-1.939]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D1, delim=3D' ', =<br /> token=3D'1', ptr=3D'as prog UNION SELECT code from aaa;<br /> '<br /> [3244-1.941]blevel=3D0 btoken=3DSELECT in_dot=3D0 in_field=3D0 tbname=3D<br /> [3244-1.942]reallocing at nfld=3D0<br /> [3244-1.942]**** got numeric: nfld =3D 0<br /> [3244-1.943]got field=3D'(null)', dot=3D'(null)'<br /> [3244-1.944]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'as', ptr=3D'prog UNION SELECT code from aaa;<br /> '<br /> [3244-1.945]blevel=3D0 btoken=3D1 in_dot=3D0 in_field=3D1 tbname=3D<br /> [3244-1.946]got AS<br /> [3244-1.946]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'prog', ptr=3D'UNION SELECT code from aaa;<br /> '<br /> [3244-1.948]blevel=3D0 btoken=3Das in_dot=3D0 in_field=3D1 tbname=3D<br /> [3244-1.948]alias for field '(null)' is 'prog'<br /> [3244-1.949]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'UNION', ptr=3D'SELECT code from aaa;<br /> '<br /> [3244-1.951]blevel=3D0 btoken=3Dprog in_dot=3D0 in_field=3D0 tbname=3Dprog=<br /> <br /> [3244-1.952]got field=3D'UNION', dot=3D'(null)' <<<<<<<<<<<<<<<<<<<<<<<<<<<=<br /> <<<<<<<<<<<<br /> [3244-1.953]unquoted=3D1, quote=3D0, dquote=3D0, numeric=3D0, delim=3D' ', =<br /> token=3D'SELECT', ptr=3D'code from aaa;<br /> <br /> <br /> <br /> <br /> This is psqlodbc_2008.log:<br /> [0.007]Driver Version=3D'08.03.0400,200811070001' linking 1400 static Multi=<br /> thread library<br /> [0.015]Global Options: fetch=3D100, socket=3D4096, unknown_sizes=3D2, max_v=<br /> archar_size=3D255, max_longvarchar_size=3D8190<br /> [0.018] disable_optimizer=3D0, ksqo=3D1, unique_index=3D1, u=<br /> se_declarefetch=3D0<br /> [0.021] text_as_longvarchar=3D1, unknowns_as_longvarchar=3D0=<br /> , bools_as_char=3D1 NAMEDATALEN=3D64<br /> [0.025] extra_systable_prefixes=3D'dd_;', conn_settings=3D''=<br /> conn_encoding=3D''<br /> [0.104] [ PostgreSQL version string =3D '8.3.4' ]<br /> [0.106] [ PostgreSQL version number =3D '8.3' ]<br /> [0.121]conn=3D031C2470, query=3D'select oid, typbasetype from pg_type where=<br /> typname =3D 'lo''<br /> [0.139] [ fetched 0 rows ]<br /> [0.148] [ Large Object oid =3D -999 ]<br /> [0.150] [ Client encoding =3D 'UTF8' (code =3D 6) ]<br /> [0.161]conn=3D031C2470, PGAPI_DriverConnect(out)=3D'DSN=3DPostgreSQL Log;DA=<br /> TABASE=3Dmuna;SERVER=3Dlocalhost;PORT=3D5432;UID=3Dclient;PW D=3Dxxxxxx;SSLm=<br /> ode=3Ddisable;ReadOnly=3D0;Protocol=3D7.4-1;FakeOidIndex=3D0 ;ShowOidColumn=<br /> =3D0;RowVersioning=3D0;ShowSystemTables=3D0;ConnSettings=3D; Fetch=3D100;Soc=<br /> ket=3D4096;UnknownSizes=3D2;MaxVarcharSize=3D255;MaxLongVarc harSize=3D8190;=<br /> Debug=3D1;CommLog=3D1;Optimizer=3D0;Ksqo=3D1;UseDeclareFetch =3D0;TextAsLong=<br /> Varchar=3D1;UnknownsAsLongVarchar=3D0;BoolsAsChar=3D1;Parse= 3D1;CancelAsFre=<br /> eStmt=3D0;ExtraSysTablePrefixes=3Ddd_;;LFConversion=3D1;Upda tableCursors=3D=<br /> 1;DisallowPremature=3D0;TrueIsMinus1=3D0;BI=3D0;ByteaAsLongV arBinary=3D1;Us=<br /> eServerSidePrepare=3D0;LowerCaseIdentifier=3D0;XaOpt=3D1'<br /> [1.909]conn=3D031C2470, query=3D'SELECT 1 as prog UNION SELECT code from =<br /> aaa;<br /> '<br /> [1.922] [ fetched 1 rows ]<br /> [1.971]conn=3D031C2470, query=3D'select current_schema()'<br /> [1.989] [ fetched 1 rows ]<br /> [2.003]conn=3D031C2470, query=3D'select nspname from pg_namespace n, pg_cla=<br /> ss c where c.relnamespace=3Dn.oid and c.oid=3D'"aaa"'::regclass'<br /> [2.024] [ fetched 1 rows ]<br /> [2.095]conn=3D031C2470, query=3D'select n.nspname, c.relname, a.attname, a.=<br /> atttypid, t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull, c.relha=<br /> srules, c.relkind, c.oid, d.adsrc from (((pg_catalog.pg_class c inner join =<br /> pg_catalog.pg_namespace n on n.oid =3D c.relnamespace and c.relname =3D E'a=<br /> aa' and n.nspname =3D E'public') inner join pg_catalog.pg_attribute a on (n=<br /> ot a.attisdropped) and a.attnum> 0 and a.attrelid =3D c.oid) inner join pg_=<br /> catalog.pg_type t on t.oid =3D a.atttypid) left outer join pg_attrdef d on =<br /> a.atthasdef and d.adrelid =3D a.attrelid and d.adnum =3D a.attnum order by =<br /> n.nspname, c.relname, attnum'<br /> [2.152] [ fetched 1 rows ]<br /> [2.289]PGAPI_Columns: table=3D'aaa',field_name=3D'code',type=3D23,name=3D'i=<br /> nt4'<br /> [2.393]STATEMENT ERROR: func=3DPGAPI_DescribeCol, desc=3D'Col#=3D1, #Cols=<br /> =3D1,1 keys=3D2', errnum=3D13, errmsg=3D'Invalid column number in DescribeC=<br /> ol.'<br /> [2.397] ---------------------------------------------------=<br /> ---------<br /> [2.398] hdbc=3D031C2470, stmt=3D031C6FD0, result=3D031C72E8<br /> [2.399] prepare=3D0, internal=3D0<br /> [2.400] bindings=3D031C89E0, bindings_allocated=3D1<br /> [2.401] parameters=3D00000000, parameters_allocated=3D0<br /> [2.402] statement_type=3D0, statement=3D'SELECT 1 as prog =<br /> UNION SELECT code from aaa;<br /> '<br /> [2.403] stmt_with_params=3D'SELECT 1 as prog UNION SELECT=<br /> code from aaa;<br /> '<br /> [2.405] data_at_exec=3D-1, current_exec_param=3D-1, put_dat=<br /> a=3D0<br /> [2.406] currTuple=3D-1, current_col=3D-1, lobj_fd=3D-1<br /> [2.406] maxRows=3D0, rowset_size=3D1, keyset_size=3D0, curs=<br /> or_type=3D0, scroll_concurrency=3D1<br /> [2.407] cursor_name=3D'SQL_CUR031C6FD0'<br /> [2.408] ----------------QResult Info ----------------------=<br /> ---------<br /> [2.409] fields=3D031C7398, backend_tuples=3D031C8698, tuple=<br /> Field=3D52201112, conn=3D031C2470<br /> [2.411] fetch_count=3D0, num_total_rows=3D1, num_fields=3D1=<br /> , cursor=3D'(NULL)'<br /> [2.412] message=3D'(NULL)', command=3D'SELECT', notice=3D'(=<br /> NULL)'<br /> [2.414] status=3D100, inTuples=3D0<br /> [2.415]CONN ERROR: func=3DPGAPI_DescribeCol, desc=3D'Col#=3D1, #Cols=3D1,1 =<br /> keys=3D2', errnum=3D0, errmsg=3D'(NULL)'<br /> [2.418] --------------------------------------------------------=<br /> ----<br /> [2.419] henv=3D031C0A70, conn=3D031C2470, status=3D1, num_stmts=<br /> =3D16<br /> [2.420] sock=3D031C0AA0, stmts=3D031C0B68, lobj_type=3D-999<br /> [2.421] ---------------- Socket Info ---------------------------=<br /> ----<br /> [2.422] socket=3D552, reverse=3D0, errornumber=3D0, errormsg=3D'=<br /> (NULL)'<br /> [2.423] buffer_in=3D52187072, buffer_out=3D52191176<br /> [2.424] buffer_filled_in=3D456, buffer_filled_out=3D0, buffer_re=<br /> ad_in=3D456<br /> [3.990]conn=3D031C2470, PGAPI_Disconnect<br /> <br /> Regards,<br /> <br /> Moreno Dissegna<br /> Developer<br /> S.A. Software S.r.l.<br /> <br /> <br /> <br /> <br /> <br /> <br /> ____________________________________________________________ _____<br /> Pi=F9 di 100 Emoticon gratis per il tuo Messenger!<br /> http://intrattenimento.it.msn.com/emoticon<br /> --=20<br /> Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)<br /> To make changes to your subscription:<br /> http://www.postgresql.org/mailpref/pgsql-odbc</p> </article> <article> <h2>Re: Show max_identifier_length causes heavy query execution</h2><span>am 29.05.2009 02:04:35 von Hiroshi Inoue</span> <p>This is a multi-part message in MIME format.<br /> --------------070101080508090402080607<br /> Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br /> Content-Transfer-Encoding: 7bit<br /> <br /> Moreno D. wrote:<br /> >> If that is the cause of your problem, then setting "Parse=1"<br /> >> will fix it.<br /> >><br /> >> In ODBC Administrator on Windows, this option is called "Parse Statements"<br /> >> and can be found in the advanced options page 1 (Button "Datasource").<br /> > <br /> > Thank you Laurenz, setting "Parse=1" solved my problem!<br /> > Anyway, another problem appeared at another point in the application, i think this is the reason why that flag was turned off.<br /> <br /> Please look at the attached documentation especially about Parse<br /> Statements, ServerSide Prepare or Disallow Premature options.<br /> <br /> regards,<br /> Hiroshi Inoue<br /> <br /> --------------070101080508090402080607<br /> Content-Type: text/html; charset=US-ASCII;<br /> name="config.html"<br /> Content-Transfer-Encoding: 7bit<br /> Content-Disposition: inline;<br /> filename="config.html"<br /> <br /> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><br /> <html><br /> <head><br /> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><br /> <title>psqlODBC Configuration Options




psqlODBC Configuration Options



Advanced Options 1/2 Dialog Box





Advanced Options 2/2 Dialog Box





Global settings Dialog Box



This dialog allows you to specify pre-connection/default logging
options





Manage DSN Dialog Box



This dialog allows you to select which PostgreSQL ODBC driver
to use for this connection. Note that this may not work with third
party drivers.



How to specify as a connection option



There is a method of specifying a connection option in a keyword strings.


Example:VBA



Please refer to a for details.






--------------070101080508090402080607
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


--=20
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

--------------070101080508090402080607--

Re: Show max_identifier_length causes heavy query execution

am 06.06.2009 13:19:18 von moreno.d

--_57ede989-662c-4577-b81c-63855270f8c6_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


>Please look at the attached documentation especially about Parse
> Statements=2C ServerSide Prepare or Disallow Premature options.
Thank you Hiroshi,
I solved my problems setting ServerSide Prepare=3D1=2C Parse statements=3D0=
and Disallow premature=3D0.
Thanks for the documentation=2C the next time I have problems I will read i=
t carefully.
I would also thank Laurenz and Ken for the help.

Moreno Dissegna
Developer
S.A. Software S.r.l.

____________________________________________________________ _____
Hai voglia di divertirti? Scarica i nuovissimi gadget di Messenger!
http://messenger.it/home_gadget.aspx=

--_57ede989-662c-4577-b81c-63855270f8c6_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable






>=3BPlease look at the attached documentation especially about Parse=

>=3B Statements=2C ServerSide Prepare or Disallow Premature options.=

Thank you Hiroshi=2C
I solved my problems setting ServerSide =
Prepare=3D1=2C Parse statements=3D0 and Disallow premature=3D0.
Thanks f=
or the documentation=2C the next time I have problems I will read it carefu=
lly.
I would also thank Laurenz and Ken for the help.

Moreno=
Dissegna
Developer
S.A. Software S.r.l.



Persona=
lizza Messenger 2009. one.aspx' target=3D'_new'>Scegli la grafica che ti rappresenta meglio!<=
/body>
=

--_57ede989-662c-4577-b81c-63855270f8c6_--