materialize-window-functions.html 1.2 KB

12345678910111213141516171819
  1. For [window functions](/sql/functions/#window-functions), when an input record
  2. in a partition (as determined by the `PARTITION BY` clause of your window
  3. function) is added/removed/changed, Materialize recomputes the results for the
  4. entire window partition. This means that when a new batch of input data arrives
  5. (that is, every second), **the amount of computation performed is proportional
  6. to the total size of the touched partitions**.
  7. For example, assume that in a given second, 20 input records change, and these
  8. records belong to **10** different partitions, where the average size of each
  9. partition is **100**. Then, amount of work to perform is proportional to
  10. computing the window function results for **10\*100=1000** rows.
  11. As a rule of thumb, if the total size of all touched window partitions is at
  12. most 1000000 rows per second, then the system should be able to keep up with the
  13. input data as it arrives. However, if your use case has higher performance
  14. requirements, consider rewriting your query to not use window functions. If your
  15. query cannot be rewritten without the window functions and the performance of
  16. window functions is insufficient for your use case, please [contact our
  17. team](/support/).