kyle1373 / Archiverse

The biggest Miiverse archive on the internet
https://www.archiverse.app
MIT License
14 stars 0 forks source link

Fix some communities resulting in gateway timeout #27

Closed kyle1373 closed 3 months ago

kyle1373 commented 3 months ago

The following were communities which resulted in a 504 gateway timeout:

gives a 504 gateway timeout if you view their posts. The queries typically take more than 30 seconds. Meanwhile, other communities do not face this issue. First, figure out why some communities result in gateway timeout, then figure out a fix to them

kyle1373 commented 3 months ago

queries:

EXPLAIN ANALYZE SELECT * FROM "Posts" WHERE "TitleId" = '14866558073375470466' AND "GameId" = '14866558073375470493' ORDER BY "EmpathyCount" DESC, "PostedDate" DESC

EXPLAIN ANALYZE SELECT * FROM "Posts" WHERE "TitleId" = '6437256808747468610' AND "GameId" = '6437256808747468620' ORDER BY "EmpathyCount" DESC, "PostedDate" DESC

EXPLAIN ANALYZE SELECT * FROM "Posts" WHERE "TitleId" = '14866558072989539884' AND "GameId" = '14866558072989539887' ORDER BY "EmpathyCount" DESC, "PostedDate" DESC

EXPLAIN ANALYZE SELECT * FROM "Posts" WHERE "TitleId" = '14866558073605628430' AND "GameId" = '14866558073605628444' ORDER BY "EmpathyCount" DESC, "PostedDate" DESC

kyle1373 commented 3 months ago

Removed 2 db indexes which were being used over other ones. I'll check back on this and if archiverse isnt getting anymore gateway timeouts then this issue is solved

kyle1373 commented 3 months ago

Looks like issue has been resolved. Removing the indexes which were used in those queries fixed it