From 90223007498fc82b95014306c9173ad682c5323b Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 1 Oct 2018 22:38:49 +0000 Subject: [PATCH] --- devdocs/todo.txt | 9 +++++++++ server/AyaNova/biz/Search.cs | 13 ++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index d76b088f..c9de12f1 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -73,6 +73,15 @@ Ensure all modern best practice security is properly enabled on helloayanova.com FUTURE ITEMS: ============= +DB INDEXES / PERFORMANCE + - Absolutely have to fine tune the indexes before release. + - Found a lot of useful info on examining index usage with postgres, there are some built in stats in Postgres that show how indexes are being used and or not used properly or usefully + - A quick search should show many ways to query for used tables etc + - Monitor unussed indexes: https://jmorano.moretrix.com/2014/02/postgresql-monitor-unused-indexes/ + - Many queries to do with tuning: https://gist.github.com/ruckus/5718112 + - Useful for learning: https://www.datadoghq.com/blog/postgresql-monitoring/ + - + CLIENT SHELL Once I can make the client I need to get into that and make the shell and initial interface with enough stuff to do basic testing initially diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index e351929f..3f608e1e 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -326,31 +326,26 @@ namespace AyaNova.Biz //MAXIMUM RESULTS FILTER //The theory is that it should be filtered BEFORE sorting so that you get the most random collection of results //As the results are not ranked so... - var watch = new System.Diagnostics.Stopwatch();//###################### PROFILING - watch.Start();//###################### PROFILING if (searchParameters.MaxResults > 0)//0 = all results MatchingObjects = MatchingObjects.Take(searchParameters.MaxResults).ToList(); - watch.Stop();//###################### PROFILING - var TimeToMaximumResultsFilter = watch.ElapsedMilliseconds;//###################### PROFILING - watch.Reset(); - watch.Start();//###################### PROFILING //Sort and group the matching objects list in return order //Customer.OrderBy(c => c.LastName).ThenBy(c => c.FirstName) var OrderedMatchingObjects = MatchingObjects.OrderBy(x => x.ObjectType).ThenByDescending(x => x.ObjectId); - watch.Stop();//###################### PROFILING - var TimeToOrderMatchingObjects = watch.ElapsedMilliseconds;//###################### PROFILING - watch.Reset(); + var watch = new System.Diagnostics.Stopwatch();//###################### PROFILING + watch.Start();//###################### PROFILING + watch.Start();//###################### PROFILING //Build the return list from the remaining matching objects list //BUGBUG: THIS is what is taking all the time in the search FFS! foreach (AyaTypeId i in OrderedMatchingObjects) { SearchResult SR = new SearchResult(); + //SR.Name = "BLAH"; SR.Name = BizObjectNameFetcher.Name(i, ct);//THIS IS PROBABLY CAUSING ALL THE SLOWNESS SR.Id = i.ObjectId; SR.Type = i.ObjectType;