Addressed potential key size issue for query invalidation