tag:blogger.com,1999:blog-8134759511126815909.post5287295474376923483..comments2023-08-20T04:10:01.095-04:00Comments on <a href="http://rogersaccessblog.blogspot.com/">Roger's Access Blog</a>: What is the fastest way to return the Record Count of a table?Roger Carlsonhttp://www.blogger.com/profile/12265719129831415014noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8134759511126815909.post-56313086820044232092009-04-23T15:18:00.000-04:002009-04-23T15:18:00.000-04:00Welcome, Roger.
(p.s. to anyone else reading this...Welcome, Roger.<br /><br />(p.s. to anyone else reading this, in my first comment I meant: "I took this a little further and found the reason _why_ the OpenRecordset version <B>(method 4a/b)</B> is so much faster...", as I wasn't very clear in that post. Need more sleep :-))Wayne Phillipshttps://www.blogger.com/profile/12488413618450256667noreply@blogger.comtag:blogger.com,1999:blog-8134759511126815909.post-469192293284487602009-04-23T15:05:00.000-04:002009-04-23T15:05:00.000-04:00Thanks for the follow-up, Wayne.Thanks for the follow-up, Wayne.Roger Carlsonhttps://www.blogger.com/profile/12265719129831415014noreply@blogger.comtag:blogger.com,1999:blog-8134759511126815909.post-67436244580011547672009-04-23T14:52:00.000-04:002009-04-23T14:52:00.000-04:00Correction to my previous comment: just found out ...Correction to my previous comment: just found out that the record number cached in the Jet table definition page is actually exposed in the TableDef object - so you can get at it that way too.Wayne Phillipshttps://www.blogger.com/profile/12488413618450256667noreply@blogger.comtag:blogger.com,1999:blog-8134759511126815909.post-63634780153290916982009-04-23T14:45:00.000-04:002009-04-23T14:45:00.000-04:00Nice find, Roger.
I took this a little further an...Nice find, Roger.<br /><br />I took this a little further and found the reason _why_ the OpenRecordset version is so much faster...<br /><br />The reason is that the OpenRecordset version simply reads the cached value which is stored in the Jet table definition page (not accessible by any ordinary means other than with a hex editor), whereas the other methods don't use that (and most of the methods probably don't have _access_ to that extra low-level data) and so have to resort to calculate the value from iterating through the indices.<br /><br />From a technical point of view it means that the OpenRecordset method will _never_ take any longer on a direct local table since it's just reading a cached 32 bit value from the file - even when you're dealing with millions of records.<br /><br />Wayne Phillips<br />http://www.everythingaccess.comWayne Phillipshttps://www.blogger.com/profile/12488413618450256667noreply@blogger.com