# 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:** 12

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2018 年 2 月 2 日午前 12:03 UTC](https://meta.discourse.org/t/slow-sql-query-causes-homepage-to-load-in-2-4-sec/74261/12 "2018-02-02T00:03:43Z")

</div>

> [@TomekB](#):
>
> highest\_staff\_post\_number highest\_post\_number,

Note, this is a slower less common variant of the query, since it applies only to staff.

Can you do some homework for me.

Split this into 4 pieces:

- staff first part prior to union all
- staff second part
- non staff (user with lots of read state) first part
- non staff second part

Then run each of these… which is slowest… what is the plan for each of the puzzle pieces.

---

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