optimize sqlquery & ProxyFactory