This document discusses building a custom data source plugin for Grafana using Vert.x to analyze timeseries data stored in a MongoDB database or large data files. It describes the challenges of efficiently querying large datasets and processing the results. Various approaches are presented, starting with a naive approach, and improving through techniques like splitting queries, aggregating results, using database aggregation pipelines, lazy loading of file indexes, and post-processing. The final architecture employs Vert.x concepts like verticles, event loops and the event bus to asynchronously process queries in parallel and aggregate the results.