Slow in VB Grid with PG

Started by pgabout 24 years ago2 messagesgeneral
Jump to latest
#1pg
pg@newhonest.com

Hi,

I have a problem with VB + PG thru ODBC.
When I do following, the speed is excellent :

--Code 1--
cmd.commandtext = "select * from table1 where parentid = '1234' "
set rst = cmd.execute
set datagrid1.datasource = rst
--End code 1--
But the grid is readonly.

--Code 2--
rst.open "select * from table1 where parentid = '1234' ", cnn, .....
set datagrid1.datasource = rst
---End Code 2 ---
This grid works fine, but extremely slow (more than 10 times slower than
code 1)

Is there a better way of manipulating grid with a better performance?

(I have only shown very little code here to avoid complexity. If it is not
enough, I'll send more)

==
====
Best Regards
Jason Kwok
==============
====

---
Virus Free
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.325 / Virus Database: 182 - Release Date: 2002/2/19

#2pg
pg@newhonest.com
In reply to: pg (#1)
Re: Slow in VB Grid with PG

Hi,

I'm answering my own question :

My original connection string looks like this:

Cnn.ConnectionString = "Provider=MSDASQL.1;Persist Security
Info=False;Extended Properties='DRIVER=
{PostgreSQL};DATABASE=test;SERVER=127.0.0.1;PORT=5432;UID=postgres;READONLY=
0;
PROTOCOL=6.4;FAKEOIDINDEX=0;SHOWOIDCOLUMN=0;ROWVERSIONING=0;SHOWSYSTEMTABLES
=0
;CONNSETTINGS=;FETCH=100;SOCKET=4096;UNKNOWNSIZES=0;MAXVARCHARSIZE=254;MAXLO
NG
VARCHARSIZE=8190;DEBUG=0;COMMLOG=0;OPTIMIZER=1;KSQO=1;USEDECLAREFETCH=0;TEXT
AS
LONGVARCHAR=1;UNKNOWNSASLONGVARCHAR=0;BOOLSASCHAR=1;PARSE=0;CANCELASFREESTMT
=0
;EXTRASYSTABLEPREFIXES=dd_'"

The I changed the "USEDECLAREFETCH" from 0 to 1, and the speed goes up as
well as the recordsets are updatable.

By the way, what is "USEDECLAREFETCH"? What will it affect? Where can I find
info about those parameters?

==
====
Best Regards
Jason Kwok
==============
====
----- Original Message -----
From: "PG" <pg@newhonest.com>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, March 05, 2002 9:22 AM
Subject: [GENERAL] Slow in VB Grid with PG

Hi,

I have a problem with VB + PG thru ODBC.
When I do following, the speed is excellent :

--Code 1--
cmd.commandtext = "select * from table1 where parentid = '1234' "
set rst = cmd.execute
set datagrid1.datasource = rst
--End code 1--
But the grid is readonly.

--Code 2--
rst.open "select * from table1 where parentid = '1234' ", cnn, .....
set datagrid1.datasource = rst
---End Code 2 ---
This grid works fine, but extremely slow (more than 10 times slower than
code 1)

Is there a better way of manipulating grid with a better performance?

(I have only shown very little code here to avoid complexity. If it is not
enough, I'll send more)

==
====
Best Regards
Jason Kwok
==============
====

---
Virus Free
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.325 / Virus Database: 182 - Release Date: 2002/2/19

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---
Virus Free
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.330 / Virus Database: 184 - Release Date: 2002/2/28