1 min read

Slowdown Opening Large Tables

A slowdown was reported launching an application that opened large tables at startup.


The problem was traced to the Classify macro command INDIRECT_FILE_SIZE, used in procedure pMain_file. INDIRECT_FILE_SIZE is similar to the DataFlex macro command FILE_SIZE, except that the file number is passed as the first parameter instead of the filename.

INDIRECT_FILE_SIZE can be used to: 1) retrieve the current number of records, maximum number of records, and the defined number of fields for the selected file, or 2) to change the maximum number of records allowed in the file. When option 1 is used, INDIRECT_FILE_SIZE retrieves attributes DF_FILE_RECORDS_USED, DF_FILE_MAX_RECORDS, and DF_FILE_NUMBER FIELDS.


DF_FILE_RECORDS_USED is retrieved through a call to SELECT COUNT(*), which counts all records in the file. This is an expensive operation that causes a noticeable application slowdown for large files.


The solution to this problem is to substitute attribute DF_FILE_MAX_RECORDS or DF_FILE_NUMBER_FIELDS for DF_FILE_RECORDS_USED in calls to INDIRECT_FILE_SIZE in cases where the current number of records in the file is not required.

 

Why Migrate from Btrieve to PostgreSQL and other Relational Databases?

Why Migrate from Btrieve to PostgreSQL and other Relational Databases?

Introduction Many independent software vendors (ISV) and corporate users still rely on applications that use a category of database collective called...

Read More
Four Challenges in Converting COBOL Applications from ISAM Databases to Relational Databases

Four Challenges in Converting COBOL Applications from ISAM Databases to Relational Databases

COBOL applications are the foundation of numerous essential business functions, especially within the banking, insurance, and government sectors....

Read More
Application Modernization 101: Ultimate Guide to Digital Transformation

Application Modernization 101: Ultimate Guide to Digital Transformation

Imagine breaking free from the constraints of old, monolithic systems and embracing the agility and innovation of cloud-based solutions.

Read More