Be careful when joining on CONCAT
Posted by Aurimas Mikalauskas |
The other day I had a case with an awful performance of a rather simple join. It was a join on tb1.vid = CONCAT(’prefix-’, tb2.id) with tb1.vid – indexed varchar(100) and tb2.id – int(11) column. No matter what I did – forced it to use key, forced a different join order, it did not want to use tb1.vid index for it. And no surprise it was way too slow, the number of rows analyzed was really huge:
[read more...]











del.icio.us
digg