Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index Route DB Optimizations #130

Open
zwolf opened this issue Feb 10, 2020 · 0 comments
Open

Index Route DB Optimizations #130

zwolf opened this issue Feb 10, 2020 · 0 comments

Comments

@zwolf
Copy link
Member

zwolf commented Feb 10, 2020

Too many queries for index pages. GET /projects is an n+toomany. It's apparently pulling the workflows just to add the ids to relationships, which has got to be optimizable.

I, [2020-02-10T20:24:15.153729 #1]  INFO -- : [8310191b3bcb3364575cb979bc87368f] Started GET "/projects" for 10.244.0.29 at 2020-02-10 20:24:15 +0000
I, [2020-02-10T20:24:15.154625 #1]  INFO -- : [8310191b3bcb3364575cb979bc87368f] Processing by ProjectsController#index as HTML
D, [2020-02-10T20:24:17.004782 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]   User Load (78.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 AND "users"."login" = $2 ORDER BY "users"."id" ASC LIMIT $3  [["id", 1325837], ["login", "zwolf"], ["LIMIT", 1]]
D, [2020-02-10T20:24:17.290874 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]    (81.0ms)  SELECT COUNT(*) FROM "projects"
D, [2020-02-10T20:24:17.291446 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]   CACHE  (0.0ms)  SELECT COUNT(*) FROM "projects"
D, [2020-02-10T20:24:17.338568 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]   Project Exists? (46.5ms)  SELECT 1 AS one FROM "projects" LIMIT $1 OFFSET $2  [["LIMIT", 1], ["OFFSET", 0]]
D, [2020-02-10T20:24:17.379943 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]   Project Load (36.4ms)  SELECT "projects".* FROM "projects" ORDER BY "projects"."id" ASC LIMIT $1 OFFSET $2  [["LIMIT", 1], ["OFFSET", 0]]
D, [2020-02-10T20:24:17.422998 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]   Project Load (39.1ms)  SELECT "projects".* FROM "projects" LIMIT $1 OFFSET $2  [["LIMIT", 30], ["OFFSET", 0]]
D, [2020-02-10T20:24:17.510766 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]    (78.9ms)  SELECT "workflows"."id" FROM "workflows" WHERE "workflows"."project_id" = $1  [["project_id", 7]]
D, [2020-02-10T20:24:17.512939 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]    (1.6ms)  SELECT "workflows"."id" FROM "workflows" WHERE "workflows"."project_id" = $1  [["project_id", 8]]
D, [2020-02-10T20:24:17.514993 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]    (1.6ms)  SELECT "workflows"."id" FROM "workflows" WHERE "workflows"."project_id" = $1  [["project_id", 9]]
D, [2020-02-10T20:24:17.517105 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]    (1.7ms)  SELECT "workflows"."id" FROM "workflows" WHERE "workflows"."project_id" = $1  [["project_id", 1764]]
D, [2020-02-10T20:24:17.519110 #1] DEBUG -- : [8310191b3bcb3364575cb979bc87368f]    (1.6ms)  SELECT "workflows"."id" FROM "workflows" WHERE "workflows"."project_id" = $1  [["project_id", 1814]]
I, [2020-02-10T20:24:17.519727 #1]  INFO -- : [8310191b3bcb3364575cb979bc87368f] Completed 200 OK in 2365ms (Views: 14.0ms | ActiveRecord: 1026.2ms | Allocations: 19854)

That's a lot of queries.

@zwolf zwolf moved this to Maintenance in TOVE Dev Plan Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Maintenance
Development

No branches or pull requests

1 participant