If DigestStorage.Connect() then
dim rs as RecordSet
rs = DigestStorage.SQLSelect( "SELECT COUNT(*) FROM tblPeptide" )
sr.Text = Str( rs.RecordCount ) + EndOfLine + EndOfLine
I can follow it through in the debugger and I get
rs = DigestStorage.SQLSelect( “SELECT COUNT(*) FROM tblPeptide” ) <- rs has a RecordCount of 3
If DigestStorage.Connect() then
dim rs as RecordSet
rs = DigestStorage.SQLSelect( "SELECT COUNT(*) FROM tblPeptide" )
sr.Text = rs.IdxField(0).StringValue + EndOfLine + EndOfLine
[quote=114307:@Eli Ott]If DigestStorage.Connect() then
dim rs as RecordSet
rs = DigestStorage.SQLSelect( “SELECT COUNT(*) FROM tblPeptide” )
sr.Text = rs.IdxField(0).StringValue + EndOfLine + EndOfLine[/quote]
Thanks, but that results in a NilObjectsException on the last line.
Count(*) will in some circumstances create a count for each field in your table. Count(1) will count each record - could be any number, it’s just placing a literal in the select statement. The other advantage is it will work with any table regardless of columns.
More importantly, COUNT(*) creates a data vector for the table, and passes some level of data thru it. Count(1) (or more traditionally COUNT(8)) does not which leads to the decrease in overhead
Why is COUNT(8) “tradtional” you ask? Look at your keyboard 8 is the unshifted version of “*”
Dave, I tried your suggestion in a large Postgres table (actually, two tables joined, just to increase the level of difficulty), and the “explain” output as presented by Valentina Studio looked identical to me. This suggests that some databases already optimize COUNT(*). Do you agree, or am I missing something?
Some database engines very well could optimize the count function where “*” is concerned…
I am going to try this on a large ORACLE table under PL/SQL at work and see what happens.
Also remember that the “*” is an argument to COUNT… you might say COUNT(distinct colors) which would be different from COUNT(colors)
You always seem to be working on apps for doing protein ID by MS.
What I am curious about is why, as most Mass Spec vendors have very capable software…
We have a Waters QToF with MassLynx along with Protein Lynx Global Server and BioPharmaLynx etc etc… and by your naming of objects/variables it appears that the code you post always seems to be related to things that type of software does…
Out of curiosity what does your code do that the commercial packages don’t?