Implement plan query