performance, index tuning etc

This commit is contained in:
2021-10-20 17:33:42 +00:00
parent 52428ef5cf
commit 8f79c06344
5 changed files with 57 additions and 52 deletions

View File

@@ -23,7 +23,7 @@ namespace AyaNova.Util
private const int DESIRED_SCHEMA_LEVEL = 1;
internal const long EXPECTED_COLUMN_COUNT = 1300;
internal const long EXPECTED_INDEX_COUNT = 146;
internal const long EXPECTED_INDEX_COUNT = 150;
internal const long EXPECTED_CHECK_CONSTRAINTS = 517;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 193;
internal const long EXPECTED_VIEWS = 11;
@@ -31,7 +31,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////////////////////////////// C1300:I146:CC517:FC193:V11:R2
///////////////////////////////////////////////////////////////// C1300:I148:CC517:FC193:V11:R2
@@ -752,6 +752,15 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
+ "CONSTRAINT chk_contract_valid CHECK((contractid IS NULL) OR (contractid IS NOT NULL AND contractexpires IS NOT NULL)) "
+ " )");
//indexes to speed up deletion
await ExecQueryAsync("CREATE INDEX idx_aunit_parentunitid ON aunit(parentunitid ASC NULLS LAST)");
await ExecQueryAsync("CREATE INDEX idx_aunit_replacedbyunitid ON aunit(replacedbyunitid ASC NULLS LAST)");
//indexes to speed up creation (validation)
await ExecQueryAsync("CREATE INDEX idx_aunit_serial ON aunit(serial)");
await ExecQueryAsync("CREATE INDEX idx_aunit_modelid ON aunit (unitmodelid ASC NULLS LAST)");
//LOANUNIT
await ExecQueryAsync("CREATE TABLE aloanunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, "
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, "