Skip to content

Counting predicate cardinality should be fast #5813

@EnricoMi

Description

@EnricoMi

Experience Report

What you wanted to do

I want to know how many uids have a specific predicate.

What you actually did

The query

{
  result (func: has(pred)) {
    count(uid)
  }
}

gives me the number of uids that have predicate pred.

Why that wasn't great, with examples

This query is very slow for large predicates. There must be some index or cardinality information for a predicate available to answer this query in constant time. The "Schema" tab in Ratel provides for predicates the "Samples & Statistics" tab, which seems to fire the same query, which takes for ever. Improving this query would also improve UX for Ratel:
grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/performancePerformance related issues.area/querylangIssues related to the query language specification and implementation.status/more-info-neededThe issue has been sent back to the reporter asking for clarifications

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions