Closed milangupta1 closed 2 years ago
Very much appreciated @milangupta1, thank you. Are there any Postgres version requirements for this version that you're aware of?
Have tested this on postgres latest. sum function uses parallel queries instead of sequential scan. Double the speed of the sum function using default postgres config !
Sounds great. I need to refactor the PR since you added directly to a migration and migrations are generated by mix tasks. Given other priorities its going to take me a few days to get to this and publish a new release.
From what I can find ... I tested it on Postgres 14.4. Parallel queries has been supported since 9.6. - https://wiki.postgresql.org/wiki/First/last_(aggregate)
There is this post where someone had an issue w/ parallel = safe syntax on 13.3 (unconfirmed). https://stackoverflow.com/questions/68424332/custom-aggregate-function-parallel-safe-produces-syntax-in-postgres-13-3
Hope this helps. Thank YOU for the library. I did not want to give up on it and decided to figure out why it was so much slower. This really sped things up.
It's great work and I learned something new today which is really helpful (I can use this technique in a couple of other libraries too!). I think I can squeeze in refactoring and getting this out the door in the next hour. Will post here when thats done.
I have published ex_money_sql version 1.7.2 with the following changelog entry:
Thank very much for the collaboration and the great PR!
Fix to enable parallel queries for aggregate function.
This adds the combine function to the aggregate and the parallel = SAFE flag.
Significant gains in performance as expected based on postgres max_parallel_workers_per_gather (default 2) and max_parallel_workers config variables.