Skip to content

Bug: get_many_and_count -> do the count on every returning row? #762

Description

@thanhlq

Description

My code like this:

results, total = await users_service.get_many_and_count(
LimitOffset(offset=0, limit=50),OrderBy(field_name="id", sort_order="asc")
)

  • id -> uuid v7
  • it took ~1.6 seconds for this query, the translated query is like this (echo):
SELECT user_account.id, user_account.email,..., count(*) OVER () AS anon_1 
FROM user_account ORDER BY user_account.id ASC 
 LIMIT %(param_1)s::INTEGER OFFSET %(param_2)s::INTEGER

URL to code causing the issue

No response

MCVE

# Your MCVE code here

Steps to reproduce

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

Screenshots

"In the format of: ![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"

Logs

Package Version

1.11.0

Platform

  • Linux
  • Mac
  • Windows
  • Other (Please specify in the description above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions