I am having difficulty understanding limits on aggregate queries.
Salesforce Documentation for ReadOnly Attribute of Visualforce Page says
Normally, queries for a single Visualforce page request may not retrieve more than 50,000 rows. In read-only mode, this limit is relaxed to allow querying up to 1,000,000 rows.
There a Visualforce Page in ReadOnly mode, the query looks like this
SELECT SUM(Quantity) From OpporunityLineItem
Where Product2Id.Family='Family1'
AND OpportunityId.CloseDate > '01 01 2019'
AND OpportunityId.StageName='Closed Won'
Assuming there are 100M records and the logged in user has read access to 50M records.
What is the number of records the query will iterate to calculate sum?
Edit : This answer suggests that there are no limits on aggregate query in ReadOnly mode. SOQL aggregate query limit [Updated for Summer18]