From 031c2432f3c8db84d1c61554f696392dcbff6656 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 1 Jun 2020 22:16:52 +0000 Subject: [PATCH] --- devdocs/specs/postgres-useful-info.txt | 27 ++++++++++++++++++++++ server/AyaNova/models/MetricDD.cs | 31 ++++++++++++++++++++++++++ server/AyaNova/models/MetricHH.cs | 28 +++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 devdocs/specs/postgres-useful-info.txt create mode 100644 server/AyaNova/models/MetricDD.cs create mode 100644 server/AyaNova/models/MetricHH.cs diff --git a/devdocs/specs/postgres-useful-info.txt b/devdocs/specs/postgres-useful-info.txt new file mode 100644 index 00000000..73c6a6bb --- /dev/null +++ b/devdocs/specs/postgres-useful-info.txt @@ -0,0 +1,27 @@ +POSTGRES USEFUL INFO + +//this is handy: +http://okigiveup.net/what-postgresql-tells-you-about-its-performance/ + +How to find log files and configure them +https://www.endpoint.com/blog/2014/11/12/dear-postgresql-where-are-my-logs + + + +2020-05-21 THIS SUPERSEDES BELOW +HOW TO FIND SHITTY INDEXES: https://gist.github.com/jberkus/6b1bcaf7724dfc2a54f3 + +top five tables by size (bytes) +SELECT + relname AS "table_name", + pg_table_size(C.oid) AS "table_size" +FROM + pg_class C +LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) +WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND nspname !~ '^pg_toast' AND relkind IN ('r') +ORDER BY pg_table_size(C.oid) +DESC LIMIT 10; + + +TOTAL DATABASE SIZE +select pg_database_size(current_database());//size in bytes \ No newline at end of file diff --git a/server/AyaNova/models/MetricDD.cs b/server/AyaNova/models/MetricDD.cs new file mode 100644 index 00000000..bea48144 --- /dev/null +++ b/server/AyaNova/models/MetricDD.cs @@ -0,0 +1,31 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace AyaNova.Models +{ + + /// + /// Metric for ONE DAY interval stats + /// + public class MetricDD + { + [Required] + [Key] + public DateTime t { get; set; } + public long AttachmentFileSize { get; set; } + public long AttachmentFileCount { get; set; } + public long AttachmentFilesAvailableSpace { get; set; } + + public long UtilityFileSize { get; set; } + public long UtilityFileCount { get; set; } + public long UtilityFilesAvailableSpace { get; set; } + + + + + //ef core requires this + public MetricDD() { t = System.DateTime.UtcNow; } + + + }//eoc +}//eons diff --git a/server/AyaNova/models/MetricHH.cs b/server/AyaNova/models/MetricHH.cs new file mode 100644 index 00000000..d93d3cc5 --- /dev/null +++ b/server/AyaNova/models/MetricHH.cs @@ -0,0 +1,28 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace AyaNova.Models +{ + + /// + /// Metric for ONE HOUR interval status + /// + public class MetricHH + { + [Required] + [Key] + public DateTime t { get; set; } + public long Test { get; set; } + + + //ef core requires this + public MetricHH() { t = System.DateTime.UtcNow; } + + public MetricHH(long test) + { + t = System.DateTime.UtcNow; + Test = test; + + } + }//eoc +}//eons