using worker_spi as pattern
| От | Jeremy Finzel | 
|---|---|
| Тема | using worker_spi as pattern | 
| Дата | |
| Msg-id | CAMa1XUgiBvoamp+E21xHpwNGfduBAF=8p4Tbvz+Vby_o5G2=Sg@mail.gmail.com обсуждение исходный текст | 
| Ответы | Re: using worker_spi as pattern | 
| Список | pgsql-hackers | 
Hello - I have compiled and installed the extension worker_spi.  I also launched the process via SELECT worker_spi_launch(1);
		
	I see this in pg_stat_activity:
WITH deleted AS (DELETE FROM schema1.counted WHERE type = 'delta' RETURNING value), total AS (SELECT coalesce(sum(value), 0) as sum FROM deleted) UPDATE schema1.counted SET value = counted.value + total.sum FROM total WHERE type = 'total' RETURNING counted.value
However, I'm not sure what I am supposed to do next?  The docs at the top of the module say:
To see it working, insert an initial value
 * with "total" type and some initial value; then insert some other rows with
 * "delta" type.  Delta rows will be deleted by this worker and their values
 * aggregated into the total.
However, this raises many questions for me:
- Insert a value into what table? I see the process referring to an object that doesn't exist in my database - schema1.counted
- What is "total" type? I don't see any type with this name in the database
- Same question for "delta" type
I am trying to use this extension as a pattern for my own background worker, but just trying to understand it.
Thanks!
Jeremy
В списке pgsql-hackers по дате отправления: