Skip to content

best way to generate partition column #159

Answered by wangxiaoying
bloukanov asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @bloukanov , thanks for bringing up this question. Setting up the partition column can be tricky, and also query and database dependent.

Adding a row number column can be a solution for partition column, but it might also compromise the performance. Here is the query plan I tried using this strategy in mssql:

And this is the query plan if using an existing numerical column in the table:

The second query plan will push down the filtering predicate to the scan operator, while the first one cannot. Which means that if we use generated row number as a partition column, the entire result needs to be generated first and then filtered. I tested it in my benchmark environment, and it is 2x s…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by bloukanov
Comment options

You must be logged in to vote
1 reply
@wangxiaoying
Comment options

Comment options

You must be logged in to vote
3 replies
@wangxiaoying
Comment options

@bloukanov
Comment options

@armamut
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants