| 371 | } |
| 372 | |
| 373 | static int create_user_indexes(cbm_store_t *s) { |
| 374 | const char *sql = |
| 375 | "CREATE INDEX IF NOT EXISTS idx_nodes_label ON nodes(project, label);" |
| 376 | "CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(project, name);" |
| 377 | "CREATE INDEX IF NOT EXISTS idx_nodes_file ON nodes(project, file_path);" |
| 378 | "CREATE INDEX IF NOT EXISTS idx_edges_source ON edges(source_id, type);" |
| 379 | "CREATE INDEX IF NOT EXISTS idx_edges_target ON edges(target_id, type);" |
| 380 | "CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(project, type);" |
| 381 | "CREATE INDEX IF NOT EXISTS idx_edges_target_type ON edges(project, target_id, type);" |
| 382 | "CREATE INDEX IF NOT EXISTS idx_edges_source_type ON edges(project, source_id, type);" |
| 383 | "CREATE INDEX IF NOT EXISTS idx_edges_url_path ON edges(project, url_path_gen);"; |
| 384 | /* NOTE: a partial expression index on json_extract(properties,'$.is_entry_point') |
| 385 | * was tried for arch_entry_points and REVERTED: json_extract in an index WHERE |
| 386 | * aborts CREATE INDEX (and thus store open) on any row whose properties JSON is |
| 387 | * malformed — and pre-fix databases contain such rows (see |
| 388 | * pipeline_def_props_valid_json_when_oversized). Revisit only with a |
| 389 | * json_valid()-guarded expression once legacy DBs have aged out. */ |
| 390 | return exec_sql(s, sql); |
| 391 | } |
| 392 | |
| 393 | int64_t cbm_store_resolve_mmap_size(void) { |
| 394 | enum { MMAP_DEFAULT = 67108864, BASE_10 = 10 }; /* default 64 MB; decimal radix */ |
no test coverage detected