# Slow SQL query causes homepage to load in 2-4 sec

**URL:** <https://meta.discourse.org/t/slow-sql-query-causes-homepage-to-load-in-2-4-sec/74261>\
**Category:** Product Support\
**Created:** [2017 年 11 月 17 日午後 1:24 UTC](https://meta.discourse.org/t/slow-sql-query-causes-homepage-to-load-in-2-4-sec/74261 "2017-11-17T13:24:17Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2018 年 2 月 4 日午前 3:47 UTC](https://meta.discourse.org/t/slow-sql-query-causes-homepage-to-load-in-2-4-sec/74261/15 "2018-02-04T03:47:34Z")

</div>

There should be a second version of this query showing up in the logs, mostly identical but without `highest_staff_post_number`.

Also note that there is a `UNION ALL` here; split the query into 2 on that.

So that’s a 2x2 matrix; try running EXPLAIN ANALYZE on all 4; is there a significant difference for staff vs nonstaff?

---

_[View the full topic](https://meta.discourse.org/t/slow-sql-query-causes-homepage-to-load-in-2-4-sec/74261)._
