I need to speed up this sql select distinct:
my conn:
Public Sub APRI_CONNESSIONE3()
On Error GoTo Err_SomeName
Set CONN3 = Nothing
Set CONN3 = New ADODB.Connection
With CONN3
.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\REPORT_L0\DATABASE\" & MIO_DB & "-L0_TEST.mdb;Persist Security Info=False"
End With
Exit_SomeName:
Exit Sub
Err_SomeName:
MsgBox Err.Number & Err.Description
Resume Exit_SomeName
End Sub
my select distinct:
Set RST0 = Nothing
Set RST0 = New ADODB.Recordset
RST0.CursorLocation = adUseClient
'RST0.CacheSize = 500
SQL = "SELECT DT FROM L0_SI WHERE (CONTAB='" & TEST_CONTAB & "') GROUP BY DT"
DoEvents
RST0.Open SQL, CONN3, adOpenForwardOnly, adLockReadOnly, adCmdText
note:
- CONTAB and DT fields are indexed
- records in table are approx 1.500.xxx
|