http://www.perlmonks.org?node_id=1043421


in reply to perl mysql full table scan

Doing it in mysql will be more efficient, because if you do it in perl, all the data has to be serialized in mysql, transferred to perl, then deserialized, and finally the matching happens.

In the other scenario, mysql only needs to transfer the matched rows to perl, so all in all there is less to do.

Finally you should consider that maybe in future an index will be added in mysql, and then it will be used automatically. If you do the scan in perl, you won't profit form the index.

The rule of thumb is to let the database do what it's good at, and only do the rest in perl.