Skip to content

Docs: Remove obsolete comment about TPC-H Q19 - #73150

Merged
rschu1ze merged 1 commit into
ClickHouse:masterfrom
rschu1ze:docs-q19
Dec 11, 2024
Merged

rschu1ze merged 1 commit into
ClickHouse:masterfrom
rschu1ze:docs-q19

Conversation

@rschu1ze

Copy link
Copy Markdown
Member

@antaljanosbenjamin

Changelog category (leave one):

  • Documentation (changelog entry is not required)

@robot-clickhouse robot-clickhouse added the pr-documentation Documentation PRs for the specific code PR label Dec 11, 2024
@antaljanosbenjamin

Copy link
Copy Markdown
Member

I have to check if the pushdown actually happens though. I think my recently merged PR is just the first step towards it.

@robot-ch-test-poll3

robot-ch-test-poll3 commented Dec 11, 2024 •

Copy link
Copy Markdown
Contributor

This is an automated comment for commit af7e912 with description of existing statuses. It's updated for the latest CI running

✅ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
Docs checkBuilds and tests the documentation✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success

@rschu1ze

Copy link
Copy Markdown
Member Author

Okay, let's put this PR on hold then.

@antaljanosbenjamin

Copy link
Copy Markdown
Member

So with optimize_extract_common_expressions = 1 the analyzer passes rewrite the query to the this:

SELECT sum(lineitem.l_extendedprice * (1 - lineitem.l_discount)) AS revenue,
FROM lineitem ALL
INNER JOIN part ON part.p_partkey = lineitem.l_partkey
WHERE part.p_size >= 1
  AND lineitem.l_shipmode IN ('AIR', 'AIR REG')
  AND lineitem.l_shipinstruct = 'DELIVER IN PERSON'
  AND 	(
			(
				part.p_brand = 'Brand#12'
				AND part.p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
				AND lineitem.l_quantity >= 1
				AND lineitem.l_quantity <= _cast(11, 'UInt16')
				AND part.p_size <= 5
			)
			OR
			(
				part.p_brand = 'Brand#23'
				AND part.p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
				AND lineitem.l_quantity >= 10
				AND lineitem.l_quantity <= _cast(20, 'UInt16')
				AND part.p_size <= 10
			)
			OR
			(	
				part.p_brand = 'Brand#34'
				AND part.p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
				AND lineitem.l_quantity >= 20
				AND lineitem.l_quantity <= _cast(30, 'UInt16')
				AND part.p_size <= 15
			)
		)

@antaljanosbenjamin

antaljanosbenjamin commented Dec 11, 2024 •

Copy link
Copy Markdown
Member

And this is how the plan looks like: https://pastila.nl/?000acc30/52ab6de82f2ee6171f7197f152321d57#D3er37H2IY02SJ6mvf8UxA==

So there are three possibilities regarding this part of the docs:

As of October 2024, the query is extremely slow due to missing join predicate pushdown. Corresponding issue: #70802

This alternative formulation works and was verified to return the reference results.

Option 1

The first sentence (query is extremely slow due to missing join predicate pushdown) is correct and the alternative query doesn't work, thus the last sentence (This alternative formulation works and was verified to return the reference results.) is false.

Option 2

The first sentence is false and the alternative query works, thus the slowness is not related to predicate pushdown, but more about planning joins.

Option 3

I massively misunderstood something.

Okay, I was completely mistaken, we push down the filters.

@rschu1ze

Copy link
Copy Markdown
Member Author

Thanks.

It is actually cool to see that part.p_size >= 1 is pulled out as well (though that condition likely doesn't help with performance).

@rschu1ze
rschu1ze added this pull request to the merge queue Dec 11, 2024
Merged via the queue into ClickHouse:master with commit 7ba4d27 Dec 11, 2024
@rschu1ze
rschu1ze deleted the docs-q19 branch December 11, 2024 19:35
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Dec 11, 2024
@antaljanosbenjamin

Copy link
Copy Markdown
Member

Yesterday I was probably tired. Technically the optimization is disabled by default, #71926 will turn it on by default. But I hope we will get that PR merged soon, so no need to revert this pr.

@antaljanosbenjamin

Copy link
Copy Markdown
Member

The performance is also confirmed to be the same (as expected) as the modified query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-documentation Documentation PRs for the specific code PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants