Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why SELECT * faster than COUNT(*) in network?
Message
 
To
07/12/2000 08:50:13
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00450286
Message ID:
00450323
Views:
34
>Hi,
> MS Access database which located in other machine.
>
>Thank you

I have done some test too and my results are different from yours!

Select * = 9 seconds
Select count(*) = 8 seconds

Here is my code:
Option Explicit

Private Sub Command1_Click()
Dim db As DAO.Database
Dim i As Integer
Dim rs As DAO.Recordset
Dim tmrStopWatch As ccrpStopWatch

    Set tmrStopWatch = New ccrpStopWatch

'    Set db = Workspaces(0).OpenDatabase("C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb")
    Set db = Workspaces(0).OpenDatabase("u:\oeq\data\donnees\oeq.mdb")
    For i = 1 To 500
        Set rs = db.OpenRecordset("select * from membre", dbopensnapshot)
        rs.Close
    Next i
    MsgBox "Elapsed time: " & Format(tmrStopWatch.Elapsed / 1000, "#,##0.000") & " seconds"
End Sub

Private Sub Command2_Click()
Dim db As DAO.Database
Dim i As Integer
Dim rs As DAO.Recordset
Dim tmrStopWatch As ccrpStopWatch

    Set tmrStopWatch = New ccrpStopWatch
    
    Set db = Workspaces(0).OpenDatabase("u:\oeq\data\donnees\oeq.mdb")
    For i = 1 To 500
        Set rs = db.OpenRecordset("select count(*) from membre", dbopensnapshot)
        rs.Close
    Next i
    MsgBox "Elapsed time: " & Format(tmrStopWatch.Elapsed / 1000, "#,##0.000") & " seconds"
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform