When I run a query on my table, I have no clue how long the process will take. I am working with a table with 11 million rows so queries typically run for a few minutes (AWS RDS). Is there a way to get a progress bar or a better sense of how long queries will take? I typically execute a query to 1/10 of the table to get an idea of the time required.
EDIT: I added my specific situation in a notebook
The query I like to run calculates a moving average for several columns. A testing query is copied below (1 column only, only for annual scores, limited output):
SELECT year,month, ptotww_m_30spfaf06, temporal_resolution,
SUM(ptotww_m_30spfaf06)
OVER(ORDER BY year ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) as ptotwwma_m_30spfaf06
FROM y2018m05d29_rh_total_demand_postgis_30spfaf06_v01_v01
WHERE temporal_resolution = 'year'
LIMIT 200
The sample already takes 52s to run and does not work with the monthly values. The monthly 10 year moving average of Jan 1969 should be the average of jan 1960, jan 1961 ... jan 1969.
EXPLAIN ANALYZEyour query so you can understand better why that query take that time to acomplish – Imanol Y. Jun 01 '18 at 09:22