This patch emits a warning when using negative slices
or indices on large result sets. Because doing
Foo.select(...)[-1] on a 1 million row table has to
fetch 1 million rows rather than just 1, it's a hidden
performance trap. This patch emits a warning when a
SelectResults is sliced with a negative index, and the
size of the result set being slices is more than 100
SelectResults usually does a good job of efficiently
getting the results you ask it for, but in this case it
doesn't, which can be surprising. This warning helps
make the problem less surprising.
Log in to post a comment.