This commit is contained in:
@@ -340,18 +340,38 @@ namespace AyaNova.Biz
|
||||
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)
|
||||
|
||||
|
||||
//EF CORE METHOD
|
||||
// //Build the return list from the remaining matching objects list
|
||||
// foreach (AyaTypeId i in OrderedMatchingObjects)
|
||||
// {
|
||||
// SearchResult SR = new SearchResult();
|
||||
// SR.Name = BizObjectNameFetcher.Name(i, ct);//THIS IS CAUSING ALL THE SLOWNESS IN RETURNING SEARCH RESULTS
|
||||
// SR.Id = i.ObjectId;
|
||||
// SR.Type = i.ObjectType;
|
||||
// ResultList.Add(SR);
|
||||
// }
|
||||
|
||||
//TEST DIRECT METHOD ##############
|
||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||
{
|
||||
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;
|
||||
ResultList.Add(SR);
|
||||
|
||||
ct.Database.OpenConnection();
|
||||
//Build the return list from the remaining matching objects list
|
||||
foreach (AyaTypeId i in OrderedMatchingObjects)
|
||||
{
|
||||
SearchResult SR = new SearchResult();
|
||||
|
||||
SR.Name = BizObjectNameFetcherDirect.Name(i, command);//THIS IS CAUSING ALL THE SLOWNESS IN RETURNING SEARCH RESULTS
|
||||
|
||||
SR.Id = i.ObjectId;
|
||||
SR.Type = i.ObjectType;
|
||||
ResultList.Add(SR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
watch.Stop();//###################### PROFILING
|
||||
var TimeToBuildSearchResultReturnList = watch.ElapsedMilliseconds;//###################### PROFILING
|
||||
|
||||
@@ -365,9 +385,6 @@ 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)"
|
||||
@@ -379,49 +396,8 @@ LIMIT 1
|
||||
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
|
||||
|
||||
|
||||
|
||||
*/
|
||||
@@ -916,7 +892,7 @@ WHERE
|
||||
{
|
||||
//Filter out short words if we are breaking for indexing
|
||||
//but keep them if they are part of a wildcard search phrase
|
||||
if (s.Length > MINWORDLENGTH || (KeepWildCards && s.Contains('%')))
|
||||
if (s.Length >= MINWORDLENGTH || (KeepWildCards && s.Contains('%')))
|
||||
{
|
||||
//Add only non stopwords
|
||||
if (!LocaleSearchData.StopWords.Contains(s))
|
||||
|
||||
Reference in New Issue
Block a user