Description
Querying database tables through datasets can be slow when the dataset is expanded with large amounts of data.
If multiple datasets have been defined in a template, exhaustion of the database connection pool will occur, as each dataset execution creates a separate database connection.
All the above issues are related to the execution of datasets. So, when will the datasets be executed?
When Will a Dataset Be Executed
1. Will a Dataset Be Executed When It Is Defined
Creating a dataset or editing the SQL query statement does not execute the dataset. Execution only occurs when you preview the defined dataset.
2. Why Expanding the Dataset Is Slow with A Large Data Volume
When a dataset is expanded, the SQL statement is executed to obtain the dataset column names. However, during expansion, the full SQL statement is not executed. Instead, only the first few records are executed to retrieve the column names. This significantly improves the speed at which the designer obtains the dataset column information, enhancing the user experience.
3. Will The Not Used Datasets Be Executed During Report Preview
If multiple datasets are defined in a template, the ones that are not used will not be executed during report preview.
In FineReport, only the cells that use a dataset in calculations will trigger the execution of the dataset during report preview. For example, if a data column is bound to cell B3, the dataset will only be executed when the report preview process reaches cell B3. At that moment, a database connection is established. After the dataset execution is completed, the connection is automatically released.
A dataset will also be executed only once. If other cells use different columns from the same dataset, the dataset will not be executed again.