Tom Wickerath said:
Albert and Tony,
I respectfully disagree with both of you.
Access is a file server--not a true relational database. I agree that Jet must scan all
rows of the appropriate table columns to recover their values for comparison with the
criteria.
Sure, the fact that access is a file based system does not change anything.
And, by the way, the fact of ms-access being a file based system has NO
RELEVANCE on the argument of it being relational. (this is two different
issues). So, no, I don't agree with the above at all. JET does not scan all
rows. How then does my example of having a table with 1 record perform the
same with a table that has 5000 records? JET uses a index when there is one.
In fact all pc based systems like FoxPro, Dbase, DataEase etc etc etc. all
use a index to speed up retrieval of a record. Ask your self how can JET
possibility retrieve one record from a table of say 100,000 records in a
blink of an eye? If it had to retrieve all records, then how could this
search occur so fast?
The speed the database would be absolute horrible if all rows had to be
scanned to retrieve a value each time. There has not been a pc database
system of any wide spread use that scans all rows. The only exception to
this would be Excel (however, I am sure we don't think of Excel as a
database). However, Excel MUST scan all rows when searching a value.
JET/Ms-access does no such thing.
I think where we differ in opinion is that I maintain that in addition to
scanning all rows, it also retrieves all rows--not just the indexes. Operations such as
sorting or filtering are done on the FE, using the entire recordset that was sent over the
wire.
No, not all. Ask your self then what does a index do for a file? Lets drop
the issue the server/client, and simply ask your self the following
question:
Why is a index faster on a file then no index?
You absolute MUST be able to understand and answer the above question. If
you do not understand the above question, then of course you will make the
errorious conclusion that every time JET executes a query, all rows are
returned. This is simply not the case.
David indicated: "No, the index is passed to Jet on FE PC, so that it can select the
record that it needs." If I am understanding him correctly, he seems to be implying that
Jet can then use this index data in such as way as to have the back-end database return
only the appropriate records from a given recordset (or that the FE database can
"cherry-pick only the appropriate records from the BE database).
Yes, that is absolute correct. In fact, not even all of the index needs to
be sent down the wire, but only parts of the "tree" structure that the index
uses. Again, there is no difference between placing the file on your hard
disk, or the hard disk down the hall. Fact is, JET does not load all
records. JET does not ALWAYS read all records to grab one record. This
process of grabbing one record via a index does not change if the file is on
drive c: or some file share. (in fact, as mentioned, JET does not even know,
or care where the file is. (same goes for word, excel etc. They are all file
based systems).
I quote the following from page 57 of "Access 2000 Client/Server Solutions", written by
Lars M. Klander (Published by Coriolis). I added the bold font shown below, although it
may not show up in the newsreader copy:
"Many people mistakenly believe that an Access MDB database file stored on a file server
acts as a database server. This isn't the case.
The above is 100% true, but the above fact has ABSOLUTE NO RELEVANCE to this
discussion of how JET retrieves a record. The above has NO change in the
fact that JET will (or will not) retrieve the whole table to grab one
record. The above makes no such claim, and the above does not change, or
apply to this discussion in any way. So, while many people may mistakenly
believe that a JET file share is a database server, that don't change what
we are saying.
You have to go back to the issue of the index, and how many records JET will
retrieve using that index. So, while it is 100% true that JET is not a
client/server based system, that argument makes no change as if JET will
*always* read the whole table. We have two issues here. No one here is
claiming that JET is a client to server, but that does not mean that JET
loads the whole table to read one record.
Assume that you have a table with 500,000 records. A user runs a query that's based on
the 500,000-record table stored in an Access database on a file server. The user wants to
see a list of all the Nevadans who make more than $75,000 per year. With the data stored
on the file server in the Access MDB file format, all records are sent over the network to
the workstation,
If the book is making the above statement, then it is wrong!
In fact, what will happen is only the list of Nevadans will be sent down the
wire IF YOU HAVE an index on that state field (so, to be more clear: the
above is true/false depending on if a index is on that field). On a true
server based system, ONLY the required records are returned REGARDLESS if a
index is present. Of course, on the server, if a index is present, then only
records meeting the Nevadans is read from the hard disk! If you further have
a index on the Yearly Salary field, then JET again can further reduce the
number of records sent down the wire (it can't do this in all cases...but it
certainly will at least restrict the list to the Nevadans).
For sure, using a server based system can reduce bandwidth requirements
more, and for sure, even when NO INDEX is present, ONLY those records that
match the criteria are returned are *sent* down the wire. With a JET/index,
then things get a more grey.
However, ask yourself how indexes work, and how many records will be read
when using a index. As mentioned, JET does not care (or even know) anything
if the file is on your drive c:, or on a VPN network connection half way
across the world.
Ask your self what happens when you move a word document to a server.
Really, the only thing that is changed is now a network is between word, and
the word doc. In the case of word, you can't load one record, or part of a
document, so yes, all of the file will have to come down the wire. And, if
the word doc is on you local drive c, then all of the document is read from
drive c: (again, note how the location of the file does NOT change how much,
or how the file will be loaded). So, in the case of ms-access, since as a
matter of normal operation all records are not loaded, then the again using
a network will not change this fact.
Again, ask yourself why, or how does a index speed up data retrieval? Ask
yourself what does a index do? Ask yourself how does a index reduce the
number of records that JET will read? The only question you have to answer
here is:
Why does a index speed things up?
What does a index do?
I mean, by using a index, how/why does retrieval time get reduced?
Further, notice how I am using the word "JET" here, as the last 3 versions
of ms-access have shipped with a true client to server based data engine on
the office cd. So, any statement, or assuming about ms-access must refer to
what data engine that you are using. (sql server, MSDE, or JET).
Ms-access is not really a database anyway, but only a CLIENT to some
database (or data engine) that you choose. We had two choices for the last 3
versions of ms-access. However, our discussion is referring to a JET file
share, and this is NOT a client to server setup. However, this issue does
not change the fact if JET is Relational, and it also does not change the
fact that JET does NOT need to read all records in a table to retrieve a
record.
There is no question here as to the fact that client to server can reduce
bandwith requriemtns better then can JET, but that don't mean JET always
reads the whole table each time it grabs a reocrd.