TimescaleDB database design - should I use inheritance?
A) No, I don't believe that type of inheritance is supported in
Timescale.
B) This won't help query performance at all, it'd probably
hurt it significantly and be a big mess.
C) I'd recommend just having
each data type as a column in the table and for each pair id filling
in the correct data type. Then you can store which pair ids use which
data types in a second table, and when you're constructing your query
you grab the correct column. You can also do the correct continuous
aggregates, grouped by pair id, with the correct aggregation for each
data type, which should mean only one continuous aggregate.

Finally, you can aggregate and then join like that, but probably not for all of the thousands of columns, there'll be some limit where that gets quite inefficient and also very difficult to deal with...are you actually using thousands of columns in a single calculation? And is it really more efficient to have them in row form? You might consider using array_agg(row(pair_id, data) ORDER BY pair_id) GROUP BY time or the like  to do something like what you want. you could also use JSON or some other thing as your return type if that's better, but I would also see if you can limit your queries to say 10s or hundreds of columns. Or split the whole thing into real tables with related columns and use the composite types to fix some of this...