G
Giobibo
I have an Access DB (Jet 3.5) with nearly 100.000 records (100 MB).
Last week I have compacted the database for the first time. After
compacting I have seen that a query is very slow, it takes nearly 4
seconds, while on the old database around 0.1 seconds (on a Pentium 4
PC, but on old Celeron it takes around 2 minutes)
The strange is that only this particular query is slower now, all other
queries take the same time as before.
The query is:
"SELECT * FROM List WHERE Date BETWEEN #" & sDate & " 00:00:00#" & " AND
#" & sDate & " 23:59:59# AND TPNr=Number"
it shows all records of a day (sDate) where the field "TPNr" has the
same value as the field "Number".
I have created the ShowPlan of the old database and of the compressed
database (see below) and noticed that they are different, in the
compacted database and index is not anymore considered (TestID).
Thus the compact action has altered the database in a way that a query
is not anymore so fast as before (I would say unusable slow)
I would appreciate any suggestion and any help to understand what
happened and how to speed up again my query.
Thank you very much.
==========================================================================
SHOWPLAN BEFORE COMPACTING
==========================================================================
- Inputs to Query -
Table 'Test'
Table 'Peak'
Using index 'TestID'
Having Indexes:
TestID 132225 entries, 446 pages, 107417 values
which has 1 column, fixed
Number 132225 entries, 612 pages, 9 values
which has 1 column, fixed
- End inputs to Query -
01) Restrict rows of table Test
using rushmore
for expression "(TDatum Between #7/19/2007# And #7/19/2007
23:59:59#) AND (TDatum Between #7/19/2007# And #7/19/2007 23:59:59#)"
02) Inner Join result of '01)' to table 'Peak'
using index 'Peak!TestID'
join expression "Test.TestID=Peak.TestID"
then test expression "TPNr=Number"
03) Sort result of '02)'
==========================================================================
==========================================================================
SHOWPLAN AFTER COMPACTING
==========================================================================
- Inputs to Query -
Table 'Test'
Table 'Peak'
Using index 'Number'
Having Indexes:
Number 132227 entries, 168 pages, 9 values
which has 1 column, fixed
- End inputs to Query -
01) Restrict rows of table Test
using rushmore
for expression "(TDatum Between #7/13/2007# And #7/13/2007
23:59:59#) AND (TDatum Between #7/13/2007# And #7/13/2007 23:59:59#)"
02) Inner Join result of '01)' to table 'Peak'
using index 'Peak!Number'
join expression "TPNr=Number"
then test expression "Test.TestID=Peak.TestID"
03) Sort result of '02)'
==========================================================================
Last week I have compacted the database for the first time. After
compacting I have seen that a query is very slow, it takes nearly 4
seconds, while on the old database around 0.1 seconds (on a Pentium 4
PC, but on old Celeron it takes around 2 minutes)
The strange is that only this particular query is slower now, all other
queries take the same time as before.
The query is:
"SELECT * FROM List WHERE Date BETWEEN #" & sDate & " 00:00:00#" & " AND
#" & sDate & " 23:59:59# AND TPNr=Number"
it shows all records of a day (sDate) where the field "TPNr" has the
same value as the field "Number".
I have created the ShowPlan of the old database and of the compressed
database (see below) and noticed that they are different, in the
compacted database and index is not anymore considered (TestID).
Thus the compact action has altered the database in a way that a query
is not anymore so fast as before (I would say unusable slow)
I would appreciate any suggestion and any help to understand what
happened and how to speed up again my query.
Thank you very much.
==========================================================================
SHOWPLAN BEFORE COMPACTING
==========================================================================
- Inputs to Query -
Table 'Test'
Table 'Peak'
Using index 'TestID'
Having Indexes:
TestID 132225 entries, 446 pages, 107417 values
which has 1 column, fixed
Number 132225 entries, 612 pages, 9 values
which has 1 column, fixed
- End inputs to Query -
01) Restrict rows of table Test
using rushmore
for expression "(TDatum Between #7/19/2007# And #7/19/2007
23:59:59#) AND (TDatum Between #7/19/2007# And #7/19/2007 23:59:59#)"
02) Inner Join result of '01)' to table 'Peak'
using index 'Peak!TestID'
join expression "Test.TestID=Peak.TestID"
then test expression "TPNr=Number"
03) Sort result of '02)'
==========================================================================
==========================================================================
SHOWPLAN AFTER COMPACTING
==========================================================================
- Inputs to Query -
Table 'Test'
Table 'Peak'
Using index 'Number'
Having Indexes:
Number 132227 entries, 168 pages, 9 values
which has 1 column, fixed
- End inputs to Query -
01) Restrict rows of table Test
using rushmore
for expression "(TDatum Between #7/13/2007# And #7/13/2007
23:59:59#) AND (TDatum Between #7/13/2007# And #7/13/2007 23:59:59#)"
02) Inner Join result of '01)' to table 'Peak'
using index 'Peak!Number'
join expression "TPNr=Number"
then test expression "Test.TestID=Peak.TestID"
03) Sort result of '02)'
==========================================================================