Is it recommended to use functions like getAll in PEAR::DB for fetching data from a database, or is there a better approach?

When fetching data from a database using PEAR::DB, it is not recommended to use functions like getAll as they can potentially retrieve a large amount of data at once, which may not be efficient in terms of memory usage. Instead, it is better to use functions like query or fetchRow to fetch data in smaller chunks or based on specific criteria.

// Example of fetching data from a database using PEAR::DB with query function
$query = "SELECT * FROM table_name WHERE column_name = ?";
$data = $db->query($query, [$value]);

while ($row = $data->fetchRow()) {
    // Process each row of data here
}