Skip to content

Open Pull-Requests view with > 500 organizations need more than 1 minute #15412

@somera

Description

@somera
  • Gitea version (or commit ref): 1.14.0
  • Git version:
  • Operating system: 20.04.2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:

Description

This with 1 minute is on my internal mini-server configuration.

I try to analyze what are you doing after I open the Pull-Requests link.

image

What I see.

First this PostgreSQL query:

explain analyze SELECT "repository"."id" FROM "repository" INNER JOIN "team_user" ON repository.owner_id = team_user.org_id INNER JOIN "team_repo" ON ('true' != 'false' and repository.is_private != 't') OR (team_user.team_id = team_repo.team_id AND repository.id = team_repo.repo_id) WHERE (team_user.uid = '1') GROUP BY repository.id

image

Which needs ~7 seconds on my NUC (https://ark.intel.com/content/www/us/en/ark/products/126137/intel-nuc-kit-nuc7pjyh.html -> I'm running here Gitea 1.14.0, PostgreSQL 13, Nginx, InfluxDB, Grafana), And after the first query I see a lot small PostgreSQL queries. I think one for every organization.

And when I choose other organization from the long list

image

I see > 500 http requests to the Gitea server

image

Looks like the process is "complicated" and not scalable for a lot of organizations and repos. Cause I have no pull requests on my Gitea instance

image

I think you should return back only all organizations which has pull requests. In my case: no one. Just the info: you dind't have any pull requests.

But this "problem" has only user with a lot of organizations and repos.

Am I right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions