What could explain an extremely high TTFB (~20-30s) when not logged in, but then drastically reduced when logged in?

What could explain an extremely high TTFB (~20-30s) when not logged in, but then drastically reduced when logged in?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)