Options

Filtering in TopK projection definition

DreaBrandfordDreaBrandford Vertica Employee Employee

Is it possible to add filters (WHERE condition) while using TOP-K Projections?

Asked during BDC session The Shortest Path to Vertica - Best Practices for Data Warehouse Migration & ETL
@marcothesane @Maurizio

Answers

  • Options
    ChuckBChuckB Vertica Employee Employee

    Not directly, but you can probably get equivalent benefits.
    Top-K projections save a fixed number of rows per key, as defined by the PARTITION BY and ORDER BY clause of the Top K. If the WHERE clause you are thinking of applies to the PARTITION BY columns, this will run quite quickly because the projection is sorted on the PARTITION BY columns. If the WHERE clause was to keep rows out of the partition, you could down-rank them in the ORDER BY.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file