raintank / worldping-api

Worldping Backend Service
Other
25 stars 18 forks source link

Use two queries to build monitor list #49

Closed ctdk closed 8 years ago

ctdk commented 8 years ago

The LEFT JOINs used to build the monitor list in pkg/service/sqlstore/monitor.go aren't entirely ideal, but while most of them don't impact performance at all yet (nor are real likely to soon), the LEFT JOIN of monitor_collector to monitor is hurting performance.

This PR breaks that query into two: one that queries the list of collector ids and their monitor_ids, grouped by monitor id, and the rest as it was before. The collector ids are then added to the monitor information struct.