On SDE on Oracle (and maybe other platforms) WFS queries against layers containing large numbers of features is very slow. This is because WFS requires computing the size of the query result before the query is executed to retrieve data. The SDE API method SEQuery.calculateTableStatistics currently used to do this is very slow (on Oracle at least).
A workaround is to run the query twice, once to count the features and once to fetch the data.
Note that due to an undocumented quirk of the SDE API, it is also necessary to call SEQuery.prepareQueryInfo before SEQuery.setSpatialConstraints. Otherwise, the spatial filter will not apply.
Attached is a small Java program to test the speed of calculateTableStatistics VS query execution. This might be useful for determining if this problem exists on other platforms.
PR is merged.
Confirmed that this now gives GeoServer good performance for WFS against SDE on Oracle.
Mass transitioning all resolved issues that have not been updated in the last month to closed state