Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Filtering in TopK projection definition

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


  • ChuckBChuckB 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
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.