mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Fix queries
This commit is contained in:
parent
d8611efbd7
commit
104a0fbf8f
|
|
@ -41,9 +41,9 @@ CREATE INDEX IF NOT EXISTS localpart_timestamp_idx ON user_daily_visits(localpar
|
||||||
|
|
||||||
const countUsersLastSeenAfterSQL = "" +
|
const countUsersLastSeenAfterSQL = "" +
|
||||||
"SELECT COUNT(*) FROM (" +
|
"SELECT COUNT(*) FROM (" +
|
||||||
" SELECT user_id FROM device_devices WHERE last_seen > $1 " +
|
" SELECT localpart FROM device_devices WHERE last_seen_ts > $1 " +
|
||||||
" GROUP BY user_id" +
|
" GROUP BY localpart" +
|
||||||
" )"
|
" ) u"
|
||||||
|
|
||||||
const countR30UsersSQL = `
|
const countR30UsersSQL = `
|
||||||
SELECT platform, COUNT(*) FROM (
|
SELECT platform, COUNT(*) FROM (
|
||||||
|
|
@ -66,7 +66,7 @@ SELECT platform, COUNT(*) FROM (
|
||||||
ON users.localpart = uip.localpart
|
ON users.localpart = uip.localpart
|
||||||
AND users.account_type <> 4
|
AND users.account_type <> 4
|
||||||
AND users.created_ts < $1
|
AND users.created_ts < $1
|
||||||
AND uip.last_seen_ts > $1,
|
AND uip.last_seen_ts > $1
|
||||||
AND (uip.last_seen_ts) - users.created_ts > $2
|
AND (uip.last_seen_ts) - users.created_ts > $2
|
||||||
GROUP BY users.localpart, platform, users.created_ts
|
GROUP BY users.localpart, platform, users.created_ts
|
||||||
) u GROUP BY PLATFORM
|
) u GROUP BY PLATFORM
|
||||||
|
|
@ -79,7 +79,7 @@ SELECT
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
user_id,
|
localpart,
|
||||||
CASE
|
CASE
|
||||||
WHEN
|
WHEN
|
||||||
LOWER(user_agent) LIKE '%%riot%%' OR
|
LOWER(user_agent) LIKE '%%riot%%' OR
|
||||||
|
|
@ -95,7 +95,7 @@ FROM
|
||||||
END as client_type
|
END as client_type
|
||||||
FROM user_daily_visits
|
FROM user_daily_visits
|
||||||
WHERE timestamp > $1 AND timestamp < $2
|
WHERE timestamp > $1 AND timestamp < $2
|
||||||
GROUP BY user_id, client_type
|
GROUP BY localpart, client_type
|
||||||
HAVING max(timestamp) - min(timestamp) > $3
|
HAVING max(timestamp) - min(timestamp) > $3
|
||||||
) AS temp
|
) AS temp
|
||||||
GROUP BY client_type
|
GROUP BY client_type
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue