jenkins-infra / uplink

A simple telemetry service for Jenkins instances.
https://uplink.jenkins.io/
GNU Affero General Public License v3.0
1 stars 2 forks source link

Switch to using a materialized view for looking up distinct types #14

Closed rtyler closed 5 years ago

rtyler commented 5 years ago
uplink=> explain analyze select distinct(type) from events;
                                                        QUERY PLAN                                                         
---------------------------------------------------------------------------------------------------------------------------
 HashAggregate  (cost=119890.58..119890.61 rows=3 width=28) (actual time=188703.954..188703.955 rows=4 loops=1)
   Group Key: type
   ->  Seq Scan on events  (cost=0.00..118281.86 rows=643486 width=28) (actual time=0.014..188424.331 rows=643478 loops=1)
 Planning time: 75.064 ms
 Execution time: 188704.006 ms
(5 rows)

uplink=> 

gross

rtyler commented 5 years ago

Thinking about this more, I think it might just make more sense to denormalize the types information into its own table behind the types service