Project

General

Profile

Actions

Question #2704

open

SQL Performance

Added by Bernhard Koschiček-Krombholz 8 days ago. Updated 3 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Backend
Target version:
-
Start date:
2026-01-15
Estimated time:

Description

I again played around with optimizing the database for performance. I created B-tree indices for columns that I think are heavily used. The result in the online version of THANADOS is around ~0.8 seconds faster. These indices are quite basic for PostgreSQL; similar ones are automatically created when a primary key is defined, so we already use those. I just expanded this approach to multiple other columns.

CREATE INDEX IF NOT EXISTS idx_entity_openatlas_class_name 
ON model.entity (openatlas_class_name);

CREATE INDEX IF NOT EXISTS idx_entity_cidoc_class_code
ON model.entity (cidoc_class_code);

CREATE INDEX IF NOT EXISTS idx_link_property_code
ON model.link (property_code);

CREATE INDEX IF NOT EXISTS idx_link_domain_id
ON model.link (domain_id);

CREATE INDEX IF NOT EXISTS idx_link_range_id
ON model.link (range_id);

CREATE INDEX IF NOT EXISTS idx_link_type_id
ON model.link (type_id);

CREATE INDEX IF NOT EXISTS idx_file_info_entity_id
ON model.file_info (entity_id);

CREATE INDEX IF NOT EXISTS idx_cidoc_class_code
ON model.cidoc_class (code);

CREATE INDEX IF NOT EXISTS idx_property_code
ON model.property (code);

CREATE INDEX IF NOT EXISTS idx_property_range_class_code
ON model.property (range_class_code);

CREATE INDEX IF NOT EXISTS idx_property_domain_class_code
ON model.property (domain_class_code);

CREATE INDEX IF NOT EXISTS idx_gis_entity_id
ON model.gis (entity_id);

ANALYZE model.entity;
ANALYZE model.link;
ANALYZE model.file_info;
ANALYZE model.gis;
ANALYZE model.cidoc_class;
ANALYZE model.property;

Just food for thought.

No data to display

Actions

Also available in: Atom PDF