[Phriction] Slow / 2500x same SQL query on root page


#1

Observed Behavior:
When opening the Phriction wiki root page (partially also on nested pages, but extremely noticeable on the root) it takes very long to load the page. Using the DarkConsole I was able to see that the most time is spent with SQL queries and further looking at it I saw that the exact same query is executed ~ 2500 times.

Query:

SELECT * FROM `phabricator_policy`.`policy` WHERE phid IN ('PHID-PLCY-ab4fszy3ruacs3mu544q');
SELECT `p`.* FROM `project` p JOIN `edge` e ON e.src = p.phid AND e.type = 60 WHERE (phid IN ('PHID-PROJ-cj4jm6eo77rz7b737jus')) AND (e.dst IN ('PHID-USER-vvl2vjjqie3sfmxujj6k')) GROUP BY p.phid  ORDER BY `p`.`name` ASC;

Facts:

  • Our root page has very large amount of direct children (listed in Document Hierarchy) and links to subpages

Expected Behavior:
Loading should not take that long, the same query should not be executed 2500 times.

Phabricator Version:
phabricator
96f9b0917e21f84995d99571d6006627590d9c00 (Thu, Nov 15)
arcanist
3534d2baca4bf6dcdac46c49164bf5ba3a6660ad (Thu, Nov 8)
phutil
0e6ee5937ca5ea4378b0b701aaf7b149e8f7f58e (Thu, Nov 15)
diff
3.3 at /usr/bin/diff
git
2.13.6 at /usr/bin/git
hg
4.5.3 at /usr/bin/hg
pygmentize
2.2.0 at /usr/bin/pygmentize
svn
1.9.7 at /usr/bin/svn

Running inside a Docker container (redpointgames/phabricator:latest).

Reproduction Steps:
Create a large amount of Phriction subpages that are directly attached to the root page. On the root page itself, create many links to other pages.

Maybe enable the Spaces app as well and set custom policies for many pages.

Please let me know if more information is needed. Thanks!