spacerspacer
Free help: USER GUIDE } WHAT'S NEW
Home > Support > Database Guide > Inside the Clients & Profits Database
spacer


Inside the Clients & Profits Database


 




See also:

Introduction

Troubleshooting flow chart + worksheet


How to troubleshoot damaged data


Database myths


Causes of data damage


How to repair


How to export/import


Troubleshooting FAQs

Tips for preventing damaged data

Inside the database

Database size

Windows tips

 




 

 


The Clients & Profits database contains a set of data records corresponding to one or more file formats (called "data files"), along with a set of indexes for those records. Clients & Profits stores its data files, field names, file connections (i.e., relations or joins) in a data dictionary inside the database.

Unlike relational databases like FoxPro and Access, Clients & Profits keeps all of its data files, indexes, etc. in a single physical file on the server's hard disk. The file has a name ending in .DF1 and looks like this:

The Clients & Profits database stores records for the 50+ data files used by the software to track clients, jobs, costs, etc. A list of the data files used by Clients & Profits can be found in the Database Utilities window (see right, or choose Setup > Utilities > Database Utilities) or from the Data Dictionary.

Each data file (e.g., JOBS, COSTS, etc.) creates a slot in the database. Clients & Profits also reserves some slots as system slots.

Database segments support large amounts of data

A Clients & Profits database may comprise up to 15 separate physical document files, called segments. Each individual segment has a maximum size of 256 mb, and is identified with a special file extension (i.e., .DF2, .DF3, .DF4, etc.). Clients & Profits treats these segments as one continuous database. Clients & Profits automatically expands the first segment (i.e., .DF1) of the database as it needs more space by adding unused disk blocks to it. This happens behind-the-scenes as users add new records to the database. When the database nears 256 megabytes, an additional segment (which will have the file extension .DF2) must be created. These additional segments can't be created or expanded automatically, so the Database Utilities window has a special "Change Database Size" function that handles them.

The Database Utilities window in Clients & Profits offers system managers a single console to monitor the database's growth, check its stability, and change its size. It also includes tools for exporting and importing data.

Always monitor the database size. It's important to regularly check the size of your Clients & Profits database, especially once it exceeds 200 megabytes. It's very easy to neglect the size until the 256 mb limit is reached, which triggers the "data files full" error -- and can cause damage to the database. It's easy to see the database size: it appears at the bottom of the Introduce Yourself window every time someone starts Clients & Profits. The Database Utilities window also has a function that can graph the database's growth over time, helping you plan when to add the next segment.

Slots, blocks, records, indexes, and pointers

The Clients & Profits database is composed of slots that contain the data from the program's various files, like jobs, clients, costs, and G/L entries. Each slot contains blocks that store bits of data from these files. A single block stores 512 characters -- that's all. So a large database can have tens of thousands of blocks, each storing 512 characters (i.e., bytes).

There are five types of blocks in the C&P database:

Data blocks
Index blocks
File header blocks
Free blocks
The "master" block

The block that stores the information for a database record is a data block. Depending on the size of an individual record, one data block may be large enough to store several records from a data file (such as time entries, which are small), or Clients & Profits might need several data blocks to store just one record (such as purchase orders, which are large).

Index blocks store index values. Every data file has special index fields which are used for finding records, such as the client number, job number, task, etc. Clients & Profits indexes the data values in a tree structure. Every record added, changed, or deleted rearranges the tree.

Free blocks are unused blocks in the data file. Clients & Profits keeps track of the free blocks in a data file in a free chain. Clients & Profits updates the free chain whenever it deletes a record from a specific data file by marking the block or partial block (depending on the size of the record) that the deleted record occupied as being available for new records.

Clients & Profits maintains a file header block for each data file in the database. File header blocks store information about the attributes of each field in a data file. This lets C&P determine whether a particular data file needs to be reorganized with each new update. The file header block also maintains a pointer to the first block in the data chain for that file, as well as a pointer to the first and last block of all indexes for that file (and other information).

Block 0 is the master block for the database, which contains critical information about the database. It holds the total block count for its own segment of the database and, if there is more than one segment in the database, also holds information about the sizes of the other segments. Block 0 also stores a pointer in the first block in the data set free chain, a directory of all files in the database, and a point to each of the file header blocks.

The pointer is like a street address. It tells Clients & Profits where a specific record (for example, a job ticket) is stored in the database. When a user finds a job ticket, Clients & Profits requests the record from file server using its address (i.e., by pointing to the block in the database). Clients & Profits doesn't actually know where the data is stored physically on the file server's hard disk. The only thing it knows is the slot, block, and pointer -- the unique address for each record in the database.

Managing multiple databases

A separate database file is created for each database you'll use, such as the tutorial database, the sample database, and your shop's database. Each database file works like any other application file; it is opened, moved, and backed up like any word processor or spreadsheet document. If your accounting department manages the books for several different companies, you'll probably have several different database files on your server's hard disk. Each database will have a unique file name, but will always end in .DF1.



The Clients & Profits database can contain 16 segments, each containing up to 256mb of clients, jobs, costs, and other data. Each database segment has a special file name extension that identifies its order in the database structure.

How Clients & Profits uses the Quick Check to look for trouble

The "quick check" function looks for early data corruption in the Clients & Profits database. It runs automatically each time a manager-level user clicks OK in the Introduce Yourself window.

The Quick Check examines the status of the database by reading only the internal headers, indexes, and pointers (not the records themselves, to save time). These records indicate corruption caused by either hardware, network, or other system failures. It doesn't attempt to systematically check the entire database for problems; that's the role of the Check Data Files function in Database Utilities. For this reason, running a quick check only takes a few seconds.

Because it is optimized for speed, the Quick Check doesn't find every kind of database damage. However, it is very effective at finding data corruption early, before it has a chance to affect the accuracy of the data. If the Quick Check function discovers some corruption, it displays what it found in a log window. If no one else is using the C&P database, clicking the Repair button will attempt to fix the corruption immediately. BE SURE TO BACK UP THE DATABASE BEFORE IT IS REPAIRED since any kind of system crash during a repair function will make the database unusable.

Since the Quick Check runs every time a manager opens the database, it is likely to find data corruption within minutes or hours of its occurrence. This time frame is important because system managers can use it to track down the cause of the corruption while the day's events are still fresh in users' minds. In shops with many manager-level users, this means the quick check is run dozens of times each day.

Next Page: Database Size



For subscribers: VIDEOS } FAQs/TECH NOTES } LEARN
     Sign up for Clients & Profits news:
     © Clients & Profits, Inc. w e  l o v e  a d v e r t i s i n g