| Base One International Corporation .NET database and distributed computing tools |
BFC | Visual Studio | Database Technology | Distributed Computing | Database Classes
MSDN News magazine from Microsoft regularly features a column called "Ask Dr.GUI" where answers are given for various technical questions. The column is usually good, very informative and useful for the developer community. However in the September/October 2001 issue of MSDN News in the column "Ask Dr.GUI #60" there is a simple question regarding the best way to browse through an SQL result set. Dr. GUI's proposed solution is both inefficient and impractical! The question posed is important and a common one that is relevant to most database applications and illustrates why Base One's Scroll Cache database class is needed. Here's the extract from Dr. GUI's column in MSDN (Microsoft Developer Network):
Flaws in the solution suggested by Dr. GUI "You can certainly use the SELECT TOP 25 FROM TABLE " This SQL query will work only with Microsoft SQL Server and not with other database systems because TOP 25 is nonstandard SQL. "Ideally, SQL Server should return the entire recordset " What if the entire result set consists of hundreds of thousands of records? The more users the worse this "solution" becomes. The system would crawl. If the entire result set is returned just to display a few pages every application would crawl because of network and server overload resulting from repeatedly fetching and transferring large amounts of unneeded data. "You can use a Select Into statement " SELECT INTO needs an output table name, which is the start of a complex mess. What table name should be used? If a table name is programmatically created, who drops the table? If the table gets dropped after the browsing is finished, what happens if the program exits abnormally and the table does not get dropped? Using "temporary" tables leads to complexity and nonstandard SQL. Once again, the more users, the worse it gets, since each user might need to create a table using SELECT INTO. That means estimating a potentially large, disk space requirements and coding for out-of-space conditions. If the same table is shared, all users would be required to compromise on the timeliness of the data and might have to accept old data created by the very first user. You get the idea. Using SELECT INTO creates extra programming work and adds needless database overhead and disk requirements when all you want to do is scroll around and browse data. "Please note: it is important that you properly manage transactions " " (preferably not using a transaction in this case)" Dr.GUI warns that programmers must use great care in transaction processing settings to avoid locking up the database. Transaction processing exists to protect the integrity, reliability, and recoverability of many database applications, most of which also need to incorporate a browsing feature. Certainly, Dr. GUI can't mean that mixing transaction processing and browsing in a single application is prohibited? Wouldn't it be better if the transaction processing settings for browsing could be taken care of automatically? Browsing though a result set usually requires a standard set of scrolling operations, such as: moving page by page, going to the last page, and skipping to a page containing a particular value. In the GUI world, users love to browse with table controls (grids) and scroll bars. In web applications, users should be able to scroll using hyperlinks, such as Next Page, Previous Page, First Page and Last Page. In Dr.GUI's scheme, all database applications that require transaction processing also require expert custom programming to prevent slow speed and occasional deadlocks. Programmers might get to discover performance problems and bugs related to transaction processing only late in the testing process. Even worse, it may be the users who discover these problems in production. Not so with Base One's Scroll Cache components. Scroll Cache and the ideal way to implement browsing Now, let us examine features users need for browsing through a result set page by page:
All of these features are completely provided by the Scroll Cache Record Set class of Base One’s Foundation Component Library (BFC). Scroll Cache is a C++ class in the Database Library that can be used by any Visual C++ application that interacts with IBM, Microsoft, MySQL, Oracle and Sybase database systems. Scroll Cache is also available with COM and .NET interfaces, with C++, C#, VB, VB.NET, ASP, and ASP.NET samples showing usage of this database component. BFC provides efficient, elegant and easy-to-implement solutions that address the complete range of database related issues. Scroll Cache is just one example of the components that the BFC toolkit provides for all sorts of database applications, big or small, web application or client server, 2-tier or 3-tier. Bottom line: Scroll Cache speeds up queries and simplifies programming. It greatly reduces the load on the database server by freeing resources after every database operation and by insuring indexes are used - to avoid sorts. The result is greatly increased scalability - far more simultaneous end-users without degrading performance. |
BFC | Visual Studio | Database Technology | Distributed Computing | Database Classes
|
|
||||||||
| Home | Products | Consulting | Case Studies | Order | Contents | Search | Contact | About Us |
|
|
||||||||
|
Copyright © 2008, Base One International Corporation |
||||||||