feat(ontology): opt-in partitioning via include list
What does this MR do and why?
Several small tables are partitioned today but never approach the part-count pressure that partitioning exists to relieve, so bucketing them just adds per-partition metadata overhead. This makes partitioning opt-in: the ontology lists which node entities and which edge tables to partition, and everything else stays single-partition.
Related Issues
Relates to #926 (closed)
Testing
Ontology validation, compiler and ontology unit tests, and the compiler integration suite pass. The generated DDL is byte-identical to leaving the small tables unpartitioned by hand, so query behavior for them is unchanged (the compiler correctly emits no partition predicate on an unpartitioned table).
Performance Analysis
Removes partitioning overhead from small tables; the large tables the scheme targets are unaffected. No query-result change.
- This merge request does not introduce any performance regression. If a performance regression is expected, explain why.
Agent context
settings.partition gains two inline allowlists:
include_entities: node entity names (e.g.[MergeRequest, Note, Pipeline, …])include_edge_tables: edge table names (e.g.[gl_edge, gl_ci_edge, …])
At load time the loader resolves both into PartitionConfig.partitioned_tables (a set of physical table names), validating entity names against the ontology's nodes and edge-table names against the edge-table configs. Both consumers gate on PartitionConfig::is_partitioned(table) (strips the v{N}_ prefix):
- DDL (
build_node_table/build_edge_table): only partitioned tables emitPARTITION BY. - Compiler pushdown (
passes/partition.rs): only partitioned aliases get a_partition_idpredicate. This is correctness, not just optimization — an unpartitioned table's single part id isall, so a_partition_id = '<bucket>'predicate would match nothing and drop every row.
Partitioned (24): 19 included node tables + 5 edge tables (gl_edge, gl_ci_edge, gl_sec_edge, gl_diff_edge, gl_code_edge). Left unpartitioned: Project, Group, WorkItem, Milestone, Label, Environment, Package, Branch, ContainerRepository, VulnerabilityScanner (plus global hubs User/Runner, which have no traversal_path).
config/graph.sql / graph_local.sql regenerated; SCHEMA_VERSION at 76.