About page slow / Menu slow to disapear

slow-sql

(Dean Taylor) #1

When selecting About from the hamburger :hamburger: menu the menu appears to be dismissed very slowly.

This is kinda two bugs / issues:

  1. Menu should be dismissed immediately upon click (from a user experience / feedback point of view).
  2. The about page is slow to load

####Although the issue doesn’t look that bad on meta:

####But when you compare that to a site with a larger number of posts:

####Possible slow query


(Mittineague) #2

I’m willing to bet there’s no “possible” about it.

I’m wondering if “real time - live” stats are needed here.

Would it be that big of a deal if “all time” and “7 days” were a bit off depending on the time the About page was looked at?

Personally, I don’t have a problem with the page load time, but maybe some kind of CRON could be used to get the stats “close enough”?

At least for the About. IMHO the Admin stats are viewed less frequently and by those more understanding so leaving them to be created “when called” should be OK as is and have benefit the way they are.


(Dean Taylor) #3

The load time isn’t that much of an issue - it’s the menu not dismissing that made me want to report it…
… it makes it “feel broken”.


(Mittineague) #4

True, it is nice to get visual confirmation that a click worked.

I would think it would be easy enough to remove the highlighting upon the click event, but maybe not.


(Jeff Atwood) #5

@neil for this page, drop the deleted_at part of the query – the total posts minus deletions is just going to be noise, how many can there possibly be? We don’t need that much accuracy here.

I am guessing

select count(*) from "posts"

will run plenty fast.


(Dean Taylor) #6

Could this be an indicator of other slowness?

Perhaps select is used elsewhere in combination with deleted_at = null.

I have reported many slow queries in the past that haven’t seen any developer action.

I’m just throwing it out there.


(Jeff Atwood) #7

Possibly but rarely select *


(Jacob Chapel) #8

Seems like there should be some logic to dismiss the dropdown on click instead of waiting for the page to load.


(Kane York) #9

Actually, yeah, this is an indicator of a missing index.

The posts table has no index on deleted_at, and almost all queries against the table filter for that!


(Sam Saffron) #10

The index only improves it a bit, it still has to scan the entire index to get the count, data here should be cached at least for a few minutes, and the transition should be smoother.


(Alan Tan) #11

I’m working on a fix right now for the dropdown not dismissing until the new page loads. I’ve provided two samples below, fadeOut('fast') and hide() respectively.

fadeOut('fast')

hide()

Would love to get some thoughts on which to go with. :smile:


(Sam Saffron) #12

fade out fast seems fine to me.


(Alan Tan) #13

Just submitted a fix to dismiss dropdowns on click. Will look into about page issue soon.

https://github.com/discourse/discourse/pull/3571


(Alan Tan) #14

Could I get a rough count of how many posts was on the site? I’m trying to reproduce the performance issue on development. Thanks :smile:


(Dean Taylor) #15

Topics: 40.1K
Posts: 432.2K
Users: 10.2K
Private Message Topics: 101.0K


(Alan Tan) #16

Patch landed on master. :smile:
https://github.com/discourse/discourse/commit/b0ea6764e0f1282e262182a3e1f048bd4b59d34f

Both issue in this topic should be resolved.


(Sam Saffron) #17

(Sam Saffron) #18

As fast as lightning ! thanks heaps :heart: