The following query is slow. It should be turned into a DistinctTermAdvancer annotation on the POS access path. We have existing code that does this for inference (materializing sub property of hierarchy) but not yet for SPARQL query. This could be implemented as an AST Optimizer.
BLZG-1089 (COUNT * should be optimized as fast range count)