T
Tom Wickerath
A HUGE "Thank You" John for performing this test, and telling us how to reproduce it. I
intend to do just that later this week when time permits.
I asked this question tonight at the Seattle area Access SIG group meeting, held on the
first Tuesday of each month on the Microsoft campus in Redmond, WA. Michael Kaplan was
present, and he answered my question. I believe I am quoting him correctly as follows:
No index means Access must pull all of the data over the network
Index present means Access can pull only the required data
On 11/30, Albert Kallal stated "I don't know where this myth, or idea comes from." I
believe I can provide that answer later this week, when I find the time to transcribe,
word-for-word, information from more than just one published source. The authors do not
mention indexes in the context of their discussions. This issue seems to have quite a few
people confused--and, it appears for good reason, given the information that is available.
Tom
______________________________________________
Tom-
I responded to your "relational" assertion yesterday. After spending some
time running some performance tests this morning, I have some numbers that I
trust will convince you that Access (JET) fetches only the minimum it needs
over the network to get the job done. You can easily reproduce this test
yourself.
Database: 1.8 million rows, name/address information. MDB file size: 420
meg. No index on City.
Problem: Find all people who live in "Baytown" - approximately 37,000 of
the rows.
Methodology: Shut down all applications that might use the network. Open
Windows XP network status window on the LAN connection. Start Access, open
the database, and open a simple query in Design View: SELECT * FROM
tblPeople WHERE City = "BayTown"
Write down the "Bytes Received" in the network status window. Switch back
to Access, switch to Datasheet view in the query, and click the Go To Last
Record button on the navigation bar.
With no index, it took approximately 55 seconds to find the last row, and
the LAN sent 14 million bytes to my machine. Note that this isn't the
entire file even though JET clearly has to do a table scan to solve the
query. Because I displayed only the first and last "page" of the Datasheet
(a total of about 100 rows), Access is doing a full fetch on only the rows
it needs to display.
Next, define a Duplicates OK index on the City field. Close the database
and close Access to flush all buffers (you can reboot if you like). Restart
Access, open the database, and open the query in Design View. Note Bytes
Received in the network status window, switch back to Access, switch to
Datasheet view, and immediately click go to last.
Result: Less than 2 seconds and only 69,000 bytes transferred. Although
there are 37,000 matching rows, again JET is transferring only the blocks
needed to satisfy my display request of the first and last "pages" of the
datasheet.
Run the same test on SQL Server, and you get about 100,000 bytes transferred
in both cases, but the query without the index takes nearly as long to solve
as JET. The only difference is all the searching is being done on the
server.
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
http://www.deanforamerica.com/site/TR?pg=personal&fr_id=1090&px=1434411
intend to do just that later this week when time permits.
I asked this question tonight at the Seattle area Access SIG group meeting, held on the
first Tuesday of each month on the Microsoft campus in Redmond, WA. Michael Kaplan was
present, and he answered my question. I believe I am quoting him correctly as follows:
No index means Access must pull all of the data over the network
Index present means Access can pull only the required data
On 11/30, Albert Kallal stated "I don't know where this myth, or idea comes from." I
believe I can provide that answer later this week, when I find the time to transcribe,
word-for-word, information from more than just one published source. The authors do not
mention indexes in the context of their discussions. This issue seems to have quite a few
people confused--and, it appears for good reason, given the information that is available.
Tom
______________________________________________
Tom-
I responded to your "relational" assertion yesterday. After spending some
time running some performance tests this morning, I have some numbers that I
trust will convince you that Access (JET) fetches only the minimum it needs
over the network to get the job done. You can easily reproduce this test
yourself.
Database: 1.8 million rows, name/address information. MDB file size: 420
meg. No index on City.
Problem: Find all people who live in "Baytown" - approximately 37,000 of
the rows.
Methodology: Shut down all applications that might use the network. Open
Windows XP network status window on the LAN connection. Start Access, open
the database, and open a simple query in Design View: SELECT * FROM
tblPeople WHERE City = "BayTown"
Write down the "Bytes Received" in the network status window. Switch back
to Access, switch to Datasheet view in the query, and click the Go To Last
Record button on the navigation bar.
With no index, it took approximately 55 seconds to find the last row, and
the LAN sent 14 million bytes to my machine. Note that this isn't the
entire file even though JET clearly has to do a table scan to solve the
query. Because I displayed only the first and last "page" of the Datasheet
(a total of about 100 rows), Access is doing a full fetch on only the rows
it needs to display.
Next, define a Duplicates OK index on the City field. Close the database
and close Access to flush all buffers (you can reboot if you like). Restart
Access, open the database, and open the query in Design View. Note Bytes
Received in the network status window, switch back to Access, switch to
Datasheet view, and immediately click go to last.
Result: Less than 2 seconds and only 69,000 bytes transferred. Although
there are 37,000 matching rows, again JET is transferring only the blocks
needed to satisfy my display request of the first and last "pages" of the
datasheet.
Run the same test on SQL Server, and you get about 100,000 bytes transferred
in both cases, but the query without the index takes nearly as long to solve
as JET. The only difference is all the searching is being done on the
server.
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
http://www.deanforamerica.com/site/TR?pg=personal&fr_id=1090&px=1434411