Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding local tables to metadata: Limitations & TO-DO's #4145

Open
onurctirtir opened this issue Sep 8, 2020 · 5 comments
Open

Adding local tables to metadata: Limitations & TO-DO's #4145

onurctirtir opened this issue Sep 8, 2020 · 5 comments

Comments

@onurctirtir
Copy link
Member

onurctirtir commented Sep 8, 2020

Limitations:

Existing limitations affecting citus local tables as well as other citus tables:

Limitations specific to citus local tables:

  • Not supporting foreign keys from reference tables to citus local tables with CASCADE, SET NULL & SET DEFAULT behaviors (RESTRICT & NO ACTION behaviors are still allowed)
  • Not allowing UPDATE/DELETEs involving postgres local and citus local tables
  • Queries from MX nodes on citus local tables having triggers might fail due to 2PC within xact blocks Do not allow accesses to citus local tables with triggers on mx workers in a xact block #4148
  • Not allowing UPDATE/DELETE of reference tables selecting from citus local tables (other way around is just OK).

Limitations that we might not think to resolve:

  • Not supporting creating foreign keys between citus local tables and postgres tables
    Solving this problem is equivalent to bringing foreign key support between postgres local tables and reference tables and that was the main point that leaded us to bring citus local tables :)

Considerations & further improvements on citus local tabes:

  • We don't allow creating citus local tables in MX worker nodes or moving citus local tables from coordinator to other MX worker nodes.
  • Related with above item, ColocationId for citus local tables is set to INVALID_COLOCATION_ID.
    We might think of setting common colocationIds for citus local tables thinking of them as grouped according to the nodes that their shard live after enabling above item.

Some other TO-DO's:

update citus_local_table set a = random()::int;
DEBUG: functions used in UPDATE queries on distributed tables must not be VOLATILE
ERROR: functions used in UPDATE queries on distributed tables must not be VOLATILE
  • Support deferred fast-path planning to allow Citus local tables rely on caching.
  • Support this using ctes's wrapping distributed tables to modify postgres local tables:
WITH cte  AS (SELECT * FROM distributed_table) update postgres_local_table SET a = cte.a FROM cte;

(Hint: DeferErrorIfUnsupportedModifyQueryWithPostgresLocalTable)

@marcocitus
Copy link
Member

Not allowing UPDATE/DELETEs involving postgres local and citus local tables

This seems to work for me on master.

@onurctirtir onurctirtir changed the title Citus Local Tables: Limitations & TO-DO's Adding local tables to metadata: Limitations & TO-DO's Feb 11, 2021
@onurctirtir
Copy link
Member Author

Not allowing UPDATE/DELETEs involving postgres local and citus local tables

This seems to work for me on master.

Updated the issue with new improvements made in 10.0 and with new improvement ideas, soon will also look into sql coverage items to see what we improved in this area.

@onderkalaci
Copy link
Member

Multi-level partitioned tables are also not supported

@onderkalaci
Copy link
Member

onderkalaci commented Apr 20, 2022

Updateable views are not supported on Citus local tables:

show citus.use_citus_managed_tables ;
┌────────────────────────────────┐
│ citus.use_citus_managed_tables │
├────────────────────────────────┤
│ on                             │
└────────────────────────────────┘


CREATE TABLE aa (a int, b int);
CREATE VIEW aav1 AS SELECT * FROM aa;
INSERT INTO aav1 VALUES (1,2);
ERROR:  cannot modify views when the query contains citus tables

@onderkalaci
Copy link
Member

Another relatively important limitation: #6318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants