code: @Override
      public int countWorkflowInstances(WorkflowInstanceFilter filter) throws Exception {
          final StringBuilder query = new StringBuilder();
          final List<Object> values = new ArrayList<>();
          query.append("SELECT COUNT(*) AS COUNT_NUMBER FROM COP_WORKFLOW_INSTANCE");
          appendQueryBase(query, values, filter);
          query.append(" ALLOW FILTERING");
          final String cqlQuery = query.toString();
          logger.info("queryWorkflowInstances - cqlQuery = {}", cqlQuery);
          final ResultSet resultSet = session.execute(cqlQuery, values.toArray());
          Row row;
          while ((row = resultSet.one()) != null) {
              return row.getInt("COUNT_NUMBER");
          }
          throw new SQLException("Failed to get result of CQL request for counting workflow instances");
      }
docs: Probably it's gonna be slow. We can consider creating counting table for that sake.