Add query counter