I am reading records from the database. The data is being fetched by a complicated query that selects certain rows from several tables.
If there are many records, the page may take a few minutes to load (we will split the data over several pages in the future). I need to show a warning that the page will take some time to load and confirm that the user wants to proceed.
Is it possible to get the number of records in advance? For example, from php resource variable?
Currently I am just fetching records with pg_fetch_row and counting them (e.g. $row_counter++). I am sure there should be a better way.