Answer the question
In order to leave comments, you need to log in
Select/where/group by on 100m-200m tables?
Feeling that I am missing something with noSql solutions, comments are welcome
There is a table with 100-200 million records, sorted by time, on which I want to quickly execute queries like
select time, field, sum(field2)
from t inner join t2 on ...
where field3 = x and field = y
and time between time1 and time2
group by time, field
order by time
Answer the question
In order to leave comments, you need to log in
I mean, such tasks are solved much easier simply by an additional table (field, sum_cache) and updating based on triggers or independently
The answer is off topic.
But since your query seems to be completely non-SQL-based, and the indexes take up a lot of space ... it may make sense to either stupidly round the time to minutes (the indexes will immediately take up 60 times less space), or enter an additional. a field with time rounded to minutes (the table will inflate, but the indexes will be smaller).
Does sum(field2) change for each field and how often? Is the speed of its recording critical?
More specifically, does field2 change? Or just adding and removing new entries?
I mean, such tasks are solved much easier with just an additional table (field, sum_cache) and an update based on triggers or on their own ... by the way, as far as I know, there are databases that support cache indexes based on expressions (in fact, they create a field and fill it with triggers )
well, or if you want to make an OLAP cube in a completely adult way and work with it. In MS SQL OLAP goes free to the server
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question