PostgreSQL - trying to speed up query responses from view that has join and group by
where id &lt;&gt; 'ALL'

is not sargable. Try to rewrite with id IN (...) or id &gt; 'ALL'
Create an index like this one :
CREATE INDEX X ON precipitaion (id, &quot;time&quot;) INCLUDE (country, prec)