global queries should be grouped properly