Optimize very slow SQL joins on multiple tables or use different engine?
Your query using joins looks ok but it will help speed up the queries if you convert the timestamp_idx key to include session_id. This way the database engine won't have to to another/second lookup/sort and on tables with millions of rows, it will have significant improvement in response times.

ALTER TABLE &lt;table name&gt; ADD KEY ix_covering(`timestamp`, `session_id`,`request_id`);


Drop both indexes on all tables AFTER you have tested that the new index as per above does improve the performance.

Also, instead of

SELECT DISTINCT
    `A`.`session_id`


try

SELECT `A`.`session_id`
FROM `logins` `A`
INNER JOIN `profile_views` `B` ON `B`.`session_id` = `A`.`session_id`
WHERE `A`.`timestamp` &gt; x
GROUP BY `A`.`session_id`
ORDER BY `session_id` DESC
LIMIT 100;