CA: use sql and named template variable for make great speedup