You can't make a translation from XPath to SQL that easily so you can't say what the maximum length of XPath is as it does not translate directly to a certain SQL length. It will also depend on the database you're using. The advice they're giving you is still valid though, try to rewrite your logic, for example add some extra enum to your entity to avoid having that many OR's on a datagrid, that would certainly help performance on retrieval as well.