If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MySQL & .Net Slow Performance

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-17-04, 01:47
jpitman jpitman is offline
Registered User
 
Join Date: Aug 2004
Posts: 2
MySQL & .Net Slow Performance

Hey Everyone -

I've been having a consistent slow performance using MySql and VB .Net, but I don't know where the slow performance is. The problem has been that when ever I set up a query, things get VERY slow. It can often take 10-20 seconds to do a very simple query in a database that has maybe 10 records total. Can anyone help me out?

Here's the environment:

- Win2k Server
- VB.Net
- MySQL ODBC Driver v 3.51.09
- MySql 4.0.20d (I tried this with v4.017 and had the same results)
- MySql was installed in the default folder (c:\mysql)

Here's the Code:


------------------------------------------
Public Function dbQry(ByVal UserID As String) As Array

Dim MySQLConn As New OdbcConnection("DSN=DSN-testdb")

Dim StartTime1, StartTime2, EndTime1, EndTime2 As DateTime

' ** Standard odbc mysql connection setup. **
MySQLConn.Open()

Dim strSQL As String = "SELECT * FROM tbl_Everyone WHERE UserID=" & UserID
Dim objCommand As OdbcCommand
objCommand = New OdbcCommand(strSQL, MySQLConn)

Dim objDataReader As OdbcDataReader
objDataReader = objCommand.ExecuteReader

Dim UserData(43) As String

If objDataReader.Read() Then
' ** Querry returned something. **
EndTime1 = DateTime.Now()
UserData(0) = objDataReader.Item("UserID")
UserData(1) = objDataReader.Item("UserName")

...
[there are about 40 objDataReader.Item reads here, and then...]
...

UserData(43) = objDataReader.Item("LFNoPrefMW")
'Querry returned nothing
End If

MySQLConn.Close()
Return UserData

End Function

--------------------------------------

If I step through the code, it appears that the .Open() statement takes about 1 to 2 seconds to complete, and the DataReader.Item statements together take an additional 20 seconds to complete.

Some other things to note:

- I've been using the exact came code to hit an MS Access database, and it's pretty fast. I get results in only a few milliseconds, so I know nothing is weird with .Net or my code.

- When I do the same query using phpMyAdmin, the results come back in about .002 seconds.

- I am still new to MySql so maybe there is some setting somewhere that I don't know about?

Thanks!!

James
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On