5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 17:26:21 +00:00

optimizar sql usando indices

This commit is contained in:
f 2022-04-23 19:06:17 -03:00
parent 0c34613cb5
commit f94ece78cf

View file

@ -37,6 +37,7 @@ class UriCollectionJob < PeriodicJob
# intervalo más amplio.
Stat::INTERVALS.reduce do |previous, current|
Rollup.where(name: 'host|uri', interval: previous)
.where('time >= ?', beginning_of_interval)
.where_dimensions(host: hostname, uri: uri)
.group("dimensions->'host'", "dimensions->'uri'")
.rollup('host|uri', interval: current, update: true) do |rollup|