Rich Text much slower than Data Grid
I have a statement that when I execute with output = Data Grid, it only takes 1.5 seconds to complete, but if I switch to Rich Text, it takes 1 hour and 20 minutes. I have max rows in Rich Text set to 1000.
It's a simple query.
What could be causing this disparity?
It's a simple query.
var pis = PIs.ToList();
pis.Dump();
What could be causing this disparity?
Comments
I then ran these in Rich Text mode and got these times:
PIs.Take(100).ToList().Dump(); = 2.4 sec
PIs.Take(200).ToList().Dump(); = 10.1 sec
PIs.Take(400).ToList().Dump(); = 38.7 sec
PIs.Take(800).ToList().Dump(); = 2min 41s
Seems exponential.
Curious, I then ran
PIs.ToList().Take(100).Dump(); = 9min 12s
Thinking it might be a column issue (e.g. computed column), I ran
PIs.Select(p => new
{
p.PI_ID,
p.attn,
p.PI1,
p.Active,
p.type,
...
(rest of the columns, but excluding related objects)
}).ToList().Dump();
but that only took 1.6 sec in Rich Text.
So I started adding in the related object fields (i.e. DEPT = p.DEPT, AREA = p.AREA) to the anonymous object and that's when things started slowing down. If I add only 2 (many:1) of the 7 related objects, the times are Rich Text = 26.7 sec, Data Grid = 2 sec. If I add only 1 (1:many) of the 7 related objects, the times are Rich Text = 31 min 43s, Data Grid = 6.8 sec
Comparing the generated SQL, when I include the related objects (in the anonymous object) it shows the left outer joins to the related tables, but in my original PIs.ToList().Dump();, it does not - only a single select.
Note: The PI table has only 20,000 records
So it appears that the issue is how the Rich Text view handles related objects compared to the Data Grid. 1:many relations are much slower than many:1 relations, but they're both slower when using Rich Text vs. Data Grid