| pgq.queue | Queue configuration |
| pgq.consumer | Consumer names |
| pgq.subscription | Consumer registrations |
| pgq.tick | Per-queue snapshots (ticks) |
| pgq.event_* | Data tables |
| pgq.retry_queue | Events to be retried later |
Standard triggers store events in the pgq.event_* data tables There is one top event table pgq.event_<queue_id> for each queue inherited from pgq.event_template wuith three tables for actual data pgq.event_<queue_id>_0 to pgq.event_<queue_id>_2.
The active table is rotated at interval, so that if all the consubers have passed some poin the oldes one can be emptied using TRUNCATE command for efficiency
| Internal Tables | |
| pgq. | Name to id lookup for consumers |
| pgq. | Information about available queues |
| pgq.tick | Snapshots for event batching |
| pgq. | Consumer registration on a queue. |
| pgq. | Parent table for all event tables |
| pgq. | Events to be retried. |
Information about available queues
| queue_id | queue id for internal usage |
| queue_name | queue name visible outside |
| queue_ntables | how many data tables the queue has |
| queue_cur_table | which data table is currently active |
| queue_rotation_period | period for data table rotation |
| queue_switch_step1 | tx when rotation happened |
| queue_switch_step2 | tx after rotation was committed |
| queue_switch_time | time when switch happened |
| queue_external_ticker | ticks come from some external sources |
| queue_ticker_paused | ticker is paused |
| queue_disable_insert | disallow pgq.insert_event() |
| queue_ticker_max_count | batch should not contain more events |
| queue_ticker_max_lag | events should not age more |
| queue_ticker_idle_period | how often to tick when no events happen |
| queue_per_tx_limit | Max number of events single TX can insert |
| queue_data_pfx | prefix for data table names |
| queue_event_seq | sequence for event id’s |
| queue_tick_seq | sequence for tick id’s |
| queue_extra_maint | array of functon names to call during maintenance |
Parent table for all event tables
| ev_id | event’s id, supposed to be unique per queue |
| ev_time | when the event was inserted |
| ev_txid | transaction id which inserted the event |
| ev_owner | subscription id that wanted to retry this |
| ev_retry | how many times the event has been retried, NULL for new events |
| ev_type | consumer/producer can specify what the data fields contain |
| ev_data | data field |
| ev_extra1 | extra data field |
| ev_extra2 | extra data field |
| ev_extra3 | extra data field |
| ev_extra4 | extra data field |