Skip to content

r.table('foo').count() should be constant time #152

Closed

Description

@coffeemug
No description provided.

Activity

  1. coffeemug commented on Mar 18, 2013

    @coffeemug
    ContributorAuthor

    Related to #53, FYI.

  2. srh commented on Aug 12, 2013

    @srh
    Contributor

    Maybe also support efficient count() for range queries that use indexes or the primary key.

  3. modified the milestones: , backlog on Mar 26, 2014
  4. modified the milestones: subsequent, on Jun 12, 2014
  5. modified the milestones: , subsequent on Jul 2, 2014
  6. coffeemug commented on Jul 2, 2014

    @coffeemug
    ContributorAuthor

    Marking as high priority. This is becoming progressively more important as RethinkDB matures, particularly because of #1271, #1984, approximate document count in the web ui that always confuses people, etc.

  7. pilwon commented on Aug 13, 2014

    @pilwon

    It would be great to show these table doc counts beside the live icons of the /#tables admin page, once count() becomes constant time.

  8. modified the milestones: , on Aug 13, 2014
  9. removed this from the milestone on Sep 4, 2014
  10. 29 remaining items

  11. removed their assignment
    on Nov 17, 2014
  12. deontologician commented on Dec 12, 2014

    @deontologician
    Contributor

    This came up again recently due to some seriously bad behavior in the document estimation code. If we had constant time count() we could skip all of the estimating

  13. danielmewes commented on Dec 12, 2014

    @danielmewes
    Member

    @deontologician Note that the specific problem is likely going away with #2034 (comment) though.

  14. deontologician commented on Dec 12, 2014

    @deontologician
    Contributor

    True, but really the problem is that we have estimates at all.

    On Fri, Dec 12, 2014 at 2:07 PM, Daniel Mewes [email protected]
    wrote:

    @deontologician https://github.com/deontologician Note that the
    specific problem is likely going away with #2034 (comment)
    #2034 (comment)
    though.

    —
    Reply to this email directly or view it on GitHub
    #152 (comment).

  15. malthe commented on Jan 14, 2015

    @malthe

    Isn't size a better term for the number of items in a table and/or index?

    It makes sense that size could be trivially (cheaply) available where a count normally costs the same as a query minus the fetching of data (and probably should be avoided).

  16. danielmewes commented on Jan 14, 2015

    @danielmewes
    Member

    @malthe That's a decent point. On the other hand count as a term has the advantage that it makes clear that the number of entries is returned (and not for example their size in bytes). It probably makes more sense to think about naming when we actually have a constant-time count/size operation...

  17. coffeemug commented on Jan 16, 2015

    @coffeemug
    ContributorAuthor

    Also, SQL uses count, which is why we appropriated the name.

  18. malthe commented on Jan 16, 2015

    @malthe

    @coffeemug right, but count is basically sum(select 1 from ...) while the index size is not a query as such (it's a kind of metadata). I mean obviously you know this, but I think it's an important difference to communicate.

  19. danielmewes commented on May 24, 2016

    @danielmewes
    Member

    Closing in favor of #3949

  20. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions