Skip to content

BUG: Why to sort in Python-side on Large Dataset #1107

@aniket866

Description

@aniket866

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Where : backend/app/database/images.py
What happened ? : images.sort(key=lambda x: x["path"]) is performed in memory in db_get_all_images.

What should be : Use ORDER BY path in the SQL query and rely on it (removing the Python-side sort).

Why?: Sorting a massive list of dictionaries in Python is CPU intensive and redundant since the DB can do it faster.

Record

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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