Open jklukas opened 3 years ago
@scholtzan - I think you've hit this a few times. Do you have an opinion about whether it's worth investing in this?
I think it might be something worth considering. I have a couple of not too complex queries that had to switch to telemetry_stable.main_v4
either because the query was too deemed to complex by BigQuery or not enough computing resources were available when using telemetry.main
. So, for me there have been quite a few times where telemetry.main
has become unusable.
We keep run into situations where user queries or ETL queries on top of
telemetry.main
start to fail with "query too complex" errors as schemas grow or the end-state queries need to add more logic.A big part of the issue is that the
main
view does several nestedSELECT AS STRUCT
queries to "clean" deeply nested fields. It also makes several UDF references, which add to query complexity. We likely could reduce complexity of the view significantly by listing out struct fields explicitly and injecting the field cleaning logic directly into the view, avoiding UDF calls.Here is a query constructed by hand that unrolls most of the complex parts of the view:
These pieces of the
main_v4
schema do not change often, but we would need to update the view whenever we do add fields tometadata
orpayload
orpayload.info
. A great future state would be that thegenerate_stable_view
module actually walks the BQ schema and generates the list of fields, but that would require significantly more code investment.