so that these queries are executed quickly using SQL solutions, use these rules of thumb. There are many caveats with this, though, and the actual SQL mechanism that you use will be very relevant to the solution.
I assume your data is integer, dated or short scaling. long lines etc. change the game. I also assume that you are using only fixed comparisons (=, <,>, <>, etc.).
a) If the time interval Y is present in each query, make sure that it is indexed if the predicate Y does not select a large percentage of rows. Make sure the lines are stored in the "Y" order so that they are packed onto the disk next to each other. This will happen, of course, in any case with new data. If the predicate Y is very dense (i.e. a few hundred lines), that may be all you need to do.
b) Do you execute "select" or "select count ()"? If you do not “select *,” then vertical partitioning may help depending on the presence of the engine and other indices.
c) Create indices of separate columns for each column where values are widespread and do not have too many duplicates. The YEAR_OF_BIRTH index will usually be fine, but indexing FEMALE_OR_MALE is often not very good - although it is very database specific.
d) If you have columns, such as FEMALE_OR_MALE and predicates Y, wide, you have another problem - choose to count the number of women from most rows. You can try indexing, but it depends on the engine.
e) Try to make the columns "NOT NULL", if possible, as a rule, it saves 1 bit per row and can simplify the work of the internal optimizer.
f) Updates / Inserts. Creating indexes often degrades insert performance, but if your course is low enough, it may not matter. With only 100M lines, I assume your insertion speed is quite low.
g) Multi-segment keys will help, but you have already said that they do not go.
h) Get high-speed disks (RPMs) - the problem for these types of requests is usually IO (TPC-H test tests relate to IO, and you sounded like a “H” problem)
There are many options, but it depends on how much effort you want to spend to "make requests as quickly as possible." There are many No-SQL and other options to solve this problem, but I will leave this part of the question different.