AbstractBeanQuery.size

Hello

I have to work with an application written with Vaadin and I encounter some performence issues.
I made some analysis and the main issue comes from a query which is used to make something like

select count(*) from table1, table2 …
where someconditions

This query will return the number of rows which will be displayed in the main screen of the application (shown by fetching data).

The query takes a long time to run and I’m wondering what it the goal of the method size in a class which implement the AbstractBeanQuery?
What could be the side effect if I hardcode another value?

Thanks in advance

Bruno