0

I am writing a Postgres C extension for a Parallel Aggregate function. Normally, in C or C++ I get my thread id and indexing of the work to be done, and then I can make sure the work can be done with no dependency and that the final result is always correct.

Absent getting an index (the row number on the table, not a postgres index) on the row I am operating on along with the worker id I cannot process anything with my aggregate function and guarantee correctness.

  1. Is there a way to get worker_id on postgres for parallel C aggregate extensions?
  2. Is there a way to get the row index/id/number from inside a C aggregate function without having to calculate it in SQL and pass it as a column to my function?

At least I know the worker ID exists, just don't know how to get it.

  • Can you show the `CREATE AGGREGATE` statement and how exactly you intend parallelization to occur? – Laurenz Albe Oct 19 '20 at 05:52
  • How I intend the parallelization to happen? hmm, that is determined by postgres. Hence the whole point about getting indexes so that no matter how postgres does it the answer is correct anyway. – ReverseFlowControl Oct 19 '20 at 15:43

0 Answers0