473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

postgreSQL query from VB 6. painfully slow

hai All
I am very new to PostgreSql.
I have given the following code to VB 6. and it takes around 2 to 3 minutes to exicute with PostgreSQL back end. However, the same code work in a fraction of a second with MS Access back end . Kindly advise me on how to improve its perfomance with PostgrSQL 8.4.2
Option Explicit

Dim dbill As New ADODB.Connection
Dim mtlmast As New ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim rss As New ADODB.Recordset
Dim cmd, mstr As String

Private Sub Form_Load()


cmd = "PROVIDER=PostgreSQL OLE DB Provider;" & _
"DATA SOURCE=192.168.1.31;" & _
"LOCATION=master;" & _
"USER ID=Admin;" & _
"PASSWORD=pass;"

With dbill
.ConnectionString = cmd
.Open
.CursorLocation = adUseClient
End With


List1.Visible = False

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 114 Then

mstr = "select * from mtls_mast where mtls_mast.matcode LIKE '" & Trim(Text1.Text) + "%'" & " order by 1;"



If rs.State <> adStateOpen Then
Else
rs.Close
End If

rs.Open mstr, dbill, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then

rs.MoveFirst

List1.Clear
Do While Not rs.EOF
List1.AddItem Left(rs.Fields("matcode") + " ", 7) + Left(rs.Fields("title") + Space(35), 35)

rs.MoveNext
Loop

List1.Visible = True
List1.SetFocus
End If
rs.Close
End If

End Sub

The table mtls_mast has 1809 records. when press F3 simply in a blank text box it take around 2 to 3 Minute. I use Windows XP SP 3. when using the select command from psql it works very well.
Expalin analyse select * from mtls_mast order by 1;
gives the follwing

index scan using mtls_mast_pkey on mtls_mast (cost =0.00..110.39 rows=1809 width=179) actual time =0.030..0.977 rows=1809 loops=1)
total run time=1.371 ms

The above code is part of programme deveped with MS Access 2000 as back end. Now I like to change the back end to postgresql 8.4.2 server. while inserting the data into postgresql it was fast enough. the table has a primary key index on feild matcode. this field is char (6) not null type.no other index.no update/ delete done on the table. However, have droped the table many time and recreated it. I assume that I have furnished all the information I know. Any further shall be given if asked for.

Please Help

Thanks in advance

Shajimon
Jan 9 '10 #1
0 1621

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mage | last post by:
Hello, I started to write my PostgreSQL layer. I tried pyPgSQL and PyGreSQL. I made a *very minimal* performance test and comparsion with the same thing in php. Table "movie" has 129 record and...
1
by: John H | last post by:
Can anyone help with why our pages are slow to load during peak-use hours? We run a database site getting 4 million hits a month which becomes painfully slow during peak hours. The slowness is...
33
by: Joshua D. Drake | last post by:
Hello, I think the below just about says it all: http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg Sincerely, Joshua Drake
20
by: My Internet | last post by:
Hello, I am in the process to define if our product can use PostgreSQL. Do you know what type of application use PostgreSQL, and also what is the size of the database for these projects? ...
4
by: cefrancke | last post by:
Are there any ways to speed up a Cumulative sum in a query or perhaps another faster way to have a cumulative sum column (call a vba function?). For example, I want to sum up all values under...
3
by: Marc Castrechini | last post by:
Forgive me on the lack of specifics but I am not a "server" guy. We just rolled our code out to a 2003 Server from Win2k Server and for some reason our pages are painfully slow. It appears the...
0
by: Jean-Michel POURE | last post by:
Dear friends, I am currently testing Ulogd ip traffic logging system with PostgreSQL. It works in conjunction with GNU/Linux iptables. The Ulogd project can be found here:...
1
by: DEHAINSALA Hondjack | last post by:
Hi ! sorry for my english ! I am french :-) I want to test postgreSQL v8 native Windows! Where i can get a version which allows more than 64 characters (NAMEDATALEN ~=128) to the name of tables...
5
by: Crash | last post by:
Is there any sort of query engine for use with .NET datasets? I have an application that has a very small disconnected client database - 2 dozen tables, largest table @100 rows. If loaded into a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.