The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Wednesday, September 2, 2009

Difference between getRowCount and getEstimatedRowCount in ADFount

In ADF applications where a VO is working on large amount of data it is could be a bad impact on using getRowCount to find the number of rows in the VO. The reason is it query the database table every time it is used. So, it incurs you a DB trip.

However, getEstimatedRowCount is a bit different. For the first time it queries to DB table using a select * from table query and store the count in the Middle-tier. After that it keeps on adjusting the count within the middle tier whenever row insertion or deletion are performed on the view object.

This way it prevents the db trip and is much faster.

The downside of this method is it may not be accurate sometimes. Specially, in the scenarios where there are possibilities of data insertion or deletion from backend by some other application at the same time.

No comments: