fixed slow customers and units list

This commit is contained in:
2021-10-14 22:30:26 +00:00
parent 1d7a71f17f
commit 40cb308fbb
2 changed files with 10 additions and 7 deletions

4
.vscode/launch.json vendored
View File

@@ -52,8 +52,8 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false", "AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "huge", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
}, },

View File

@@ -1,3 +1,5 @@
//#define AYSHOWQUERYINFO
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using AyaNova.Biz; using AyaNova.Biz;
@@ -12,6 +14,7 @@ namespace AyaNova.DataList
internal static class DataListFetcher internal static class DataListFetcher
{ {
//////////////////////////////////////////////// ////////////////////////////////////////////////
// Get the data list data requested // Get the data list data requested
// //
@@ -52,7 +55,7 @@ namespace AyaNova.DataList
int returnRowColumnCount = dataListTableProcessingOptions.Columns.Count(); int returnRowColumnCount = dataListTableProcessingOptions.Columns.Count();
List<List<DataListField>> rows = new List<List<DataListField>>(); List<List<DataListField>> rows = new List<List<DataListField>>();
long totalRecordCount = 0; long totalRecordCount = 0;
#if (DEBUG) #if (DEBUG && AYSHOWQUERYINFO)
System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
#endif #endif
@@ -65,12 +68,12 @@ namespace AyaNova.DataList
command.CommandText = qDataQuery; command.CommandText = qDataQuery;
try try
{ {
#if (DEBUG) #if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Start(); stopWatch.Start();
#endif #endif
using (var dr = await command.ExecuteReaderAsync()) using (var dr = await command.ExecuteReaderAsync())
{ {
#if (DEBUG) #if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Stop(); stopWatch.Stop();
log.LogInformation($"(debug) DataListFetcher:GetResponse DATA query took {stopWatch.ElapsedMilliseconds}ms to execute: {qDataQuery}"); log.LogInformation($"(debug) DataListFetcher:GetResponse DATA query took {stopWatch.ElapsedMilliseconds}ms to execute: {qDataQuery}");
stopWatch.Reset(); stopWatch.Reset();
@@ -160,12 +163,12 @@ namespace AyaNova.DataList
//GET TOTAL RECORD COUNT //GET TOTAL RECORD COUNT
command.CommandText = qTotalRecordsQuery; command.CommandText = qTotalRecordsQuery;
#if (DEBUG) #if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Start(); stopWatch.Start();
#endif #endif
using (var dr = await command.ExecuteReaderAsync()) using (var dr = await command.ExecuteReaderAsync())
{ {
#if (DEBUG) #if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Stop(); stopWatch.Stop();
log.LogInformation($"(debug) DataListFetcher:GetResponse COUNT query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}"); log.LogInformation($"(debug) DataListFetcher:GetResponse COUNT query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}");
#endif #endif