Re: Eager aggregation, take 3
От | Matheus Alcantara |
---|---|
Тема | Re: Eager aggregation, take 3 |
Дата | |
Msg-id | CAFY6G8f0gY1PVQaBFA=8eAL=guZsOV-8YuWGnA2BtuS=ySBRbw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Eager aggregation, take 3 (Richard Guo <guofenglinux@gmail.com>) |
Ответы |
Re: Eager aggregation, take 3
|
Список | pgsql-hackers |
[ getting back to testing this patch ...] On my last email you replied: >> Debugging this query shows that all if conditions on >> setup_eager_aggregation() returns false and create_agg_clause_infos() >> and create_grouping_expr_infos() are called. The RelAggInfo->agg_useful >> is also being set to true so I would expect to see Finalize and Partial >> agg nodes, is this correct or am I missing something here? > > Well, just because eager aggregation *can* be applied does not mean > that it *will* be; it depends on whether it produces a lower-cost > execution plan. This transformation is cost-based, so it's not the > right mindset to assume that it will always be applied when possible. > Sorry for the noise here. I didn't consider the costs. On Sun Sep 28, 2025 at 11:09 PM -03, Richard Guo wrote: > On Thu, Sep 25, 2025 at 1:23 PM Richard Guo <guofenglinux@gmail.com> wrote: >> Attached is an updated version of the patch with these optimizations >> applied. > > FWIW, I plan to do another self-review of this patch soon, with the > goal of assessing whether it's ready to be pushed. If anyone has any > concerns about any part of the patch or would like to review it, I > would greatly appreciate hearing from you. > I spent some time testing patch v23 using the TPC-DS benchmark and am seeing worse execution times when using eager aggregation. The most interesting cases are: Query | planning time | execution time | query 31 | -2.03% │ -99.56% │ query 71 | -15.51% │ -68.88% │ query 20 | -10.77% │ -32.40% │ query 26 | -28.01% │ -32.35% │ query 85 | -10.57% │ -31.91% │ query 77 | -30.07% │ -31.38% │ query 69 | -32.79% │ -29.21% │ query 32 | -68.48% │ -27.89% │ query 57 | -7.99% │ -27.32% │ query 91 | -24.81% │ -26.20% │ query 23 | -11.72% │ -18.24% │ The query 31 seems bad, I don't know if I'm doing something completely wrong but I've just setup a TPC-DS database and then executed the query on master and with the v23 patch and I got these results: Master: Planning Time: 3.191 ms Execution Time: 16950.619 ms Patch: Planning Time: 3.257 ms Execution Time: 3848355.646 ms Note that I've executed ANALYZE before running the queries on both scenarios (master and patched). I'm attaching an EXPLAIN(ANALYZE) output for the query 31 from master and with the patch applied. Please let me know if there is any other test that I can run to benchmark this patch. -- Matheus Alcantara
Вложения
В списке pgsql-hackers по дате отправления: