-
-
Save squadette/a65b84807ceb78158b162da0fb67b37e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `timeline_entries` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`created_at` datetime NOT NULL, | |
`timeline_id` int(11) NOT NULL, | |
`post_id` int(11) NOT NULL, | |
`fresh_at` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `index_timeline_entries_on_post_id_and_timeline_id` (`post_id`,`timeline_id`) USING BTREE, | |
KEY `index_timeline_entries_on_timeline_id_and_created_at` (`timeline_id`,`created_at`) USING BTREE, | |
KEY `index_timeline_entries_on_timeline_id_and_fresh_at` (`timeline_id`,`fresh_at`) USING BTREE | |
) ENGINE=InnoDB AUTO_INCREMENT=151276917 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | |
SELECT `timeline_entries`.* | |
FROM `timeline_entries` | |
WHERE `timeline_entries`.`timeline_id` IN (<ids...>) | |
AND (`timeline_entries`.`post_id` NOT IN ( | |
SELECT `timeline_entries`.`post_id` FROM `timeline_entries` WHERE `timeline_entries`.`timeline_id` = <id>) | |
) | |
ORDER BY `timeline_entries`.`fresh_at` DESC | |
LIMIT 151 | |
OFFSET 450 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment