This commit is contained in:
@@ -363,7 +363,7 @@ namespace AyaNova
|
|||||||
// ******************** TESTING WIPE DB *****************************
|
// ******************** TESTING WIPE DB *****************************
|
||||||
//
|
//
|
||||||
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
||||||
var TESTING_REFRESH_DB = false;
|
var TESTING_REFRESH_DB = true;
|
||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
//TESTING
|
//TESTING
|
||||||
|
|||||||
@@ -358,6 +358,70 @@ namespace AyaNova.Biz
|
|||||||
//Before attempt to optimize name fetcher
|
//Before attempt to optimize name fetcher
|
||||||
//22548, 21187, 20462, 22336, 20094 - AVG = 21325
|
//22548, 21187, 20462, 22336, 20094 - AVG = 21325
|
||||||
|
|
||||||
|
/*
|
||||||
|
explain analyze SELECT m.name
|
||||||
|
FROM awidget AS m
|
||||||
|
WHERE m.id = 12989
|
||||||
|
LIMIT 1
|
||||||
|
|
||||||
|
"Limit (cost=0.29..8.30 rows=1 width=27) (actual time=0.079..0.080 rows=1 loops=1)"
|
||||||
|
" -> Index Scan using awidget_pkey on awidget m (cost=0.29..8.30 rows=1 width=27) (actual time=0.077..0.077 rows=1 loops=1)"
|
||||||
|
" Index Cond: (id = 12989)"
|
||||||
|
"Planning time: 0.098 ms"
|
||||||
|
"Execution time: 0.102 ms"
|
||||||
|
|
||||||
|
|
||||||
|
//All index data
|
||||||
|
select * from pg_stat_user_indexes
|
||||||
|
|
||||||
|
|
||||||
|
SELECT indexrelname,cast(idx_tup_read AS numeric) / idx_scan AS avg_tuples,idx_scan,idx_tup_read FROM pg_stat_user_indexes WHERE idx_scan > 0;
|
||||||
|
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
t.tablename,
|
||||||
|
indexname,
|
||||||
|
c.reltuples AS num_rows,
|
||||||
|
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size,
|
||||||
|
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size,
|
||||||
|
CASE WHEN indisunique THEN 'Y'
|
||||||
|
ELSE 'N'
|
||||||
|
END AS UNIQUE,
|
||||||
|
idx_scan AS number_of_scans,
|
||||||
|
idx_tup_read AS tuples_read,
|
||||||
|
idx_tup_fetch AS tuples_fetched
|
||||||
|
FROM pg_tables t
|
||||||
|
LEFT OUTER JOIN pg_class c ON t.tablename=c.relname
|
||||||
|
LEFT OUTER JOIN
|
||||||
|
( SELECT c.relname AS ctablename, ipg.relname AS indexname, x.indnatts AS number_of_columns, idx_scan, idx_tup_read, idx_tup_fetch, indexrelname, indisunique FROM pg_index x
|
||||||
|
JOIN pg_class c ON c.oid = x.indrelid
|
||||||
|
JOIN pg_class ipg ON ipg.oid = x.indexrelid
|
||||||
|
JOIN pg_stat_all_indexes psai ON x.indexrelid = psai.indexrelid )
|
||||||
|
AS foo
|
||||||
|
ON t.tablename = foo.ctablename
|
||||||
|
WHERE t.schemaname='public'
|
||||||
|
ORDER BY 7,1,2;
|
||||||
|
|
||||||
|
|
||||||
|
Unused indexes?
|
||||||
|
SELECT
|
||||||
|
relid::regclass AS table,
|
||||||
|
indexrelid::regclass AS index,
|
||||||
|
pg_size_pretty(pg_relation_size(indexrelid::regclass)) AS index_size,
|
||||||
|
idx_tup_read,
|
||||||
|
idx_tup_fetch,
|
||||||
|
idx_scan
|
||||||
|
FROM
|
||||||
|
pg_stat_user_indexes
|
||||||
|
JOIN pg_index USING (indexrelid)
|
||||||
|
WHERE
|
||||||
|
idx_scan > 0
|
||||||
|
AND indisunique IS FALSE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
return ResultList;
|
return ResultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace AyaNova.Util
|
|||||||
private const int DESIRED_SCHEMA_LEVEL = 9;
|
private const int DESIRED_SCHEMA_LEVEL = 9;
|
||||||
|
|
||||||
internal const long EXPECTED_COLUMN_COUNT = 99;
|
internal const long EXPECTED_COLUMN_COUNT = 99;
|
||||||
internal const long EXPECTED_INDEX_COUNT = 23;
|
internal const long EXPECTED_INDEX_COUNT = 24;
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user