Some commands are ignored in citus_stat_tenants
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
In terms of `query_count_XXX`, I wouldn't care merge. However, in terms of `cpu_XXX`, it might be useful to have merge command here as Merge can be a heavy query in terms of processing.
```SQL
CREATE TABLE source
(
order_id INT,
customer_id INT,
order_center VARCHAR,
order_time timestamp
);
CREATE TABLE target
(
customer_id INT,
last_order_id INT,
order_center VARCHAR,
order_count INT,
last_order timestamp
);
SELECT create_distributed_table('target', 'customer_id');
SELECT create_distributed_table('source', 'customer_id');
SELECT citus_stat_tenants_reset();
-- single task query
MERGE INTO target t
USING source s
ON (t.customer_id = s.customer_id) AND t.customer_id = 30002 AND s.customer_id = 30002
WHEN MATCHED AND t.order_center = 'XX' THEN
DELETE
WHEN MATCHED THEN
UPDATE SET -- Existing customer, update the order count and last_order_id
order_count = t.order_count + 1,
last_order_id = s.order_id
WHEN NOT MATCHED THEN
DO NOTHING;
select tenant_attribute,query_count_in_this_period from citus_stat_tenants;
tenant_attribute | query_count_in_this_period
------------------+----------------------------
(0 rows)
```
Contributor guide
Assessment
This issue has not been assessed yet.