How to Estimate Size of Basic ISAM Database Components (69112)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q69112

SUMMARY

Using the output of ISAMPACK.EXE can give you a rough estimate of the size of an ISAM database.

MORE INFORMATION

Because an ISAM file contains descriptive information, it has some size overhead. This overhead is required for the speed and efficiency that ISAM files possess compared to random access files. With this overhead, data manipulation, such as searches, seeks, and sorts, becomes extremely easy. The ISAM engine is responsible for all this data manipulation, which allows you to spend your time developing the code, and frees you from worrying about the fine details of the database management.

You can use the output of the ISAMPACK.EXE utility to roughly guess the size of the components of an ISAM database.

The ISAM database is divided into several components, which have the following size requirements:

  1. The database requires a header of 3K for its own use.
  2. The system data dictionary requires 39K.
  3. Each table requires 4K of overhead beyond the data space.
  4. Each index is allocated in 2K chunks.
  5. Actual data is allocated in 2K increments.
Additionally, to optimize speed and flexibility, the file will grow in large increments of 32K, rather than in record-size increments as single records are added. For this same reason, the indexes and data are allocated in 2K chunks. Although the files are quite large compared to random access files, the ISAM file has room for growth and can be extremely fast. This can be a hurdle for some programmers, and is an important consideration when designing a program. Please read "ISAM Componenets/When to Use ISAM" on Pages 101-102 of the "Microsoft Visual Basic for MS-DOS: Professional Edition Features" manual, or "ISAM Components/When to Use ISAM" on Page 329 of the "Microsoft Basic 7.0: Programmer's Guide" (for versions 7.0 and 7.1) to determine which is more appropriate for your needs, ISAM files or random access files.

The following tables were constructed using the sample database AMAZRAYS.MDB and the output from ISAMPACK.EXE.

To run ISAMPACK.EXE, first invoke the PROISAMD.EXE TSR (Terminate-and-Stay-Resident) program, then use the following arguments for ISAMPACK.EXE:
   ISAMPACK AMAZRAYS.MDB AMAZRAYS.RPT
				
More information on ISAMPACK.EXE can be found on Page 150 of the "Microsoft Visual Basic for MS-DOS: Professional Edition Features" manual, or on Page 394 of the "Microsoft Basic 7.0: Programmer's Guide."

Header

  • Each database requires a 3K header. 3K

Data Dictionary

  • Five system tables and eight system indexes. 39K

Tables Overhead

  • Each table has 4K of overhead beyond its actual data records.
          BookStock
          CardHolders
          BooksOut             3 * 4K =                              12K
    						

Indexes

  • Each index is allocated in 2K chunks:
        IndexName      Columns        Size   NumRecords  Size   Actual
       ---------      -------        ----   ----------  ----   ------
    
      TitleIndexBS    Title(50)       50         1       50     2K
    
      AuthorIndexBS   Author(36)      36         1       36     2K
    
      PubIndexBS      Publisher(50)   50         1       50     2K
    
      IDIndex         IDnum(8)         8         1        8     2K
    
      BigIndex        Title(50)       94         1        94    2K
                      Author(36)
                      IDnum(8)
    
     NameIndexCH      TheName(36)     36         1        36    2K
    
     StateIndexCH     State(2)         2         1         2    2K
    
     ZipIndexCH       Zip(4)           4         1         4    2K
    
     CardNumIndexCH   CardNum(4)       4         1         4    2K
    
     IDIndexBO        IDnum(8)         8         1         8    2K
    
     CardNumIndexBO   CardNum(4)       4         1         4    2K
    
                                           Total Index Space...      22K
    						

Database

  • Each database is allocated in 2K chunks.
       Table        b/rec    #rec     Calc(K)  Act(K)
       -----        -----    ----     -------  ------
    
       BookStock     154       1        0.15     2K
       CardHolders   122       1        0.12     2K
       BooksOut       20       1        0.02     2K
    
                                                       Total...        6K
    						

Database Size

  • Growth is in 32K chunks.
                                      Grand total(82K)...     83,968 bytes
       Adjusted for 32K chunk (3 * 32K * 1024 bytes/K)...     98,304 bytes
               Actual file reported after packing file...     98,304 bytes
    						

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB69112