実行計画を見ておく。
コードはこんな感じで。
Option Compare Database
Option Explicit
Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long
Sub test0()
Dim i As Long, Counts As Long
For i = 1 To 10
Counts = test
Debug.Print i, Counts
Next
Debug.Print Now
End Sub
Function test() As Long
Dim dbs As DAO.Database, rs As DAO.Recordset, i As Long
Set dbs = CurrentDb
i = GetTickCount
Set rs = dbs.OpenRecordset("select * from tbl01 WHERE Code = 1000 Order By FDate desc;")
Do Until rs.EOF
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
dbs.Close: Set dbs = Nothing
test = GetTickCount - i
End Function
出力は、
1 109 2 62 3 63 4 24523 5 4852 6 62 7 63 8 62 9 62 10 63 2011/07/17 17:38:50
そのときのSHOWPLAN.out
---------------------------------------------
DATE: 0
VER: 14.00.6023
NOTE: Currently does not handle subqueries, vt parameters, and subqueries
NOTE: You may see ERROR messages in these cases
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
--- temp query ---
- Inputs to Query -
Table 'tbl01'
- End inputs to Query -
01) Restrict rows of table tbl01
using rushmore
for expression "Code=1000"
02) Sort result of '01)'
0 件のコメント:
コメントを投稿