Before Select : 9:36:51
After Select: 9:36:51
After First: 9:36:51
After RecordCount: 9:38:02
After for: 9:38:02
I don't understand the elapsed time for the recordcount function.
This is problematic because DBGrid and datasource means using recordcount. It's not possible to receive this value on select function ?
Record counting implies fetching all rows... This makes it a bad idea to get all records. I read some times setting filtering to true
It could maybe be avoided if Oracle OCI has a way of getting the number of result rows directly? No idea about that. Maybe it would require some redesign of the general design.
A separate select has some serious disadvantages :
- Query time doubles.
- Parsing problems when making the count(*) query
- Doesn't work for stored procedures returning resultsets (I know that sounds like madness to an oracle dev but other databases do support it)
The 'First' call is a fetch already. That doesn't read all records. So if you simply loop using first + next until EOF you read only record by record.
It's the recordcount which starts fetching all the records.