× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



>I added a new method that only does a count(*).  It's still
>not that much faster.  And since I really don't need fields
>in my query (only getting a count), I am not retrieving any
>fields from the DB.

You don't know that for sure.  It depends on a couple of things:

1.  Whether you have a WHERE clause or not in your query.

2.  Internal details of the data base and who implemented what inside the
DB itself.

Depending on these two questions, the DB code may still be scanning a lot
of records even if you don't think it should be.  The hardest thing about
all this SQL stuff is to think about not just what gets returned as the
result, but what the DB code may have to fetch _and not return_ to get the
job you asked for done.  And, whether it is really doing the "obvious" and
fastest thing.  This doesn't always happen.  Making the best results happen
is consuming many patents and Ph D theses as I write. . .so this is not
something that is always easy to get right or even to imagine what's
happening as opposed to the "obvious" implementation of one's query.

A simple COUNT(*) (with no WHERE clause) should be fast on OS/400, but not
necessarily so on other DBs.


Larry W. Loen  -   Senior Linux, Java, and iSeries Performance Analyst
                          Dept HP4, Rochester MN




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.