Subject: | resultset.result_source is evaluated in numeric context |
In a Catalyst application:
$c->stash{itemsrs} = $c->model('MyApp::String')->search(...);
In a TT file:
[% itemsrs.result_source %]
causes a SELECT COUNT(*) FROM ... me.
This is a performance penalty for PostgreSQL: in my setup, it causes a
0.5s delay for a 300k record table.
An excerpt from #tt:
[09:45] <mst> ash: rs.result_source
[09:45] <mst> ash: evaluates rs in numeric context at some point
[09:45] <mst> ash: thus triggering a COUNT(*)
[09:45] <mst> there is no reason at all for it to be doing that
[09:46] <ash> numeric like mst said perhaps >_>
[09:46] * quicksilver nods
[09:50] <mst> it's got to be numeric context
[09:50] <mst> resultsets numify to $self->count
[09:50] <ash> i wasnt aware of that
[09:50] <mst> for consistency on numeric ops whether you've got a $rs or
@records