Ask HN: Generating reports on time series data without killing performance?
I have an application which contains approximately 10 million time series records growing at a rate of 1 million per year. This application generates reports on subsets of the time series data. These reports have poor performance characteristics because for each record in a time series, another subset of time series data must often be loaded as part of the computations behind the report. Effectively this can lead to N^2 performance. The current workaround is to implement these reports as stored procedures in the Oracle database where the time series data resides. This saves network roundtrips for every time series record.
I've found the stored procedures to be insufficiently flexible to handle complex requirements compared to modern programming languages (requirements come in for new reports on a regular basis). I'd like to generate these reports in application code (C#) but can't see a way around the performance issue. Has anyone dealt with similar challenges and how did you work around them?
14 comments
[ 2.6 ms ] story [ 48.1 ms ] threadEdit: If you're saying mirror the time series data onto the application server to avoid the network roundtrip, I guess that is possible but we still face the SQL overhead with each query.
To give a very broad example of one report: take 10,000 latest time series records from geographic location X. Now for each of those records load the latest 100 time series records from location Y and Z. Multiply all records from Y and Z together then divide by the value at location X. Throw in lots of business rules at every one of these steps so we have no chance of representing this as a tidy join operation and so that we can make no assumptions about the data we'll need to load to generate the report :)
Edit - returning multiple result sets from the server is always an option too.
Sorry, I probably edited my post while you were typing. The amount of data to load is theoretically unbounded (could load the entire data set for a big report) and it's very difficult to estimate ahead of time which data needs to be loaded. This is because the data in the time series dictates which secondary sets of data will be loaded on a record-by-record basis.
Yeah, this is the unfortunate conclusion that I arrived at too. I'm looking at making these reports go through a job queue which e-mails the result to the user when it's done. This would allow me to develop much more complex, but much slower queries in C#.
You could always use a sliding window type algorithm to keep up with the grown of the data.
2. If the rate of data acquisition is 1 million records a year, then 9 million records are the same as last year. There's no reason to hit the database again, because time series data [to be time series data] does not change.
3. This suggests that processing the data from the Oracle database is not a requirement...i.e. it could be moved to another system and processed there. Again, it's small data and doesn't change so duplication presents neither a storage issue nor a consistency issue.
4. The size and static nature of the data suggest that it might fit into memory on a single, moderately speced PC. An AWS type approach is also possible.
5. The right data storage format depends on the workload...maybe something column oriented?
Good luck.
Let us know.