Skip to content

Instantly share code, notes, and snippets.

@Cameron-D
Created June 6, 2013 02:55
Show Gist options
  • Select an option

  • Save Cameron-D/5719000 to your computer and use it in GitHub Desktop.

Select an option

Save Cameron-D/5719000 to your computer and use it in GitHub Desktop.
This is the query that MySQL generates when querying against the view.
select `p`.`nid` AS `nid`,`h`.`hid` AS `hid`,`h`.`name` AS `hookname`,`h`.`type` AS `type`,`p`.`dateline` AS `dateline`,`bau_forum`.`u`.`uid` AS `uid`,`bau_forum`.`u`.`username` AS `username`,`bau_forum`.`u`.`usergroup` AS `usergroup`,`bau_forum`.`u`.`displaygroup` AS `displaygroup`,`bau_forum`.`u`.`avatar` AS `avatar`,`post`.`fid` AS `fid`,`post`.`tid` AS `tid`,`t`.`subject` AS `thread_subject`,`post`.`pid` AS `post_id`,`post`.`subject` AS `post_subject` from `bau_forum`.`mybb_proactivity_log` `p` join `bau_forum`.`mybb_proactivity_hooks` `h` join `bau_forum`.`mybb_users` `u` join `bau_forum`.`mybb_posts` `post` join `bau_forum`.`mybb_threads` `t` left join `bau_forum`.`mybb_proactivity_hidden` `hide` on(((`bau_forum`.`hide`.`hid` = `h`.`hid`) and (`bau_forum`.`hide`.`uid` = '297'))) left join `bau_forum`.`mybb_proactivity_hide_threads` `hide_thread` on(((`bau_forum`.`hide_thread`.`tid` = `post`.`tid`) and (`bau_forum`.`hide_thread`.`uid` = '297'))) left join `bau_forum`.`mybb_proactivity_hide_forums` `hide_forum` on(((`bau_forum`.`hide_forum`.`uid` = '297') and (`post`.`fid` = `bau_forum`.`hide_forum`.`fid`))) where ((`p`.`hid` = `h`.`hid`) and (`bau_forum`.`u`.`uid` = `p`.`uid`) and (`post`.`pid` = `p`.`data`) and (`t`.`tid` = `post`.`tid`) and isnull(`bau_forum`.`hide`.`hid`) and isnull(`bau_forum`.`hide_thread`.`tid`) and isnull(`bau_forum`.`hide_forum`.`fid`) and (`bau_forum`.`u`.`uid` <> '297') and (`p`.`nid` <= '24751') and (`post`.`fid` <> '') and (`t`.`visible` <> 0) and (`post`.`visible` <> 0) and (`h`.`type` = 'post')) order by `p`.`nid` desc limit 15
SELECT `p`.`nid` AS `nid`,
`h`.`hid` AS `hid`,
`h`.`name` AS `hookname`,
`h`.`type` AS `type`,
`p`.`dateline` AS `dateline`,
`bau_forum`.`u`.`uid` AS `uid`,
`bau_forum`.`u`.`username` AS `username`,
`bau_forum`.`u`.`usergroup` AS `usergroup`,
`bau_forum`.`u`.`displaygroup` AS `displaygroup`,
`bau_forum`.`u`.`avatar` AS `avatar`,
`post`.`fid` AS `fid`,
`post`.`tid` AS `tid`,
`t`.`subject` AS `thread_subject`,
`post`.`pid` AS `post_id`,
`post`.`subject` AS `post_subject`
FROM `bau_forum`.`mybb_proactivity_log` `p`
JOIN `bau_forum`.`mybb_proactivity_hooks` `h`
JOIN `bau_forum`.`mybb_users` `u`
JOIN `bau_forum`.`mybb_posts` `post`
JOIN `bau_forum`.`mybb_threads` `t`
LEFT JOIN `bau_forum`.`mybb_proactivity_hidden` `hide` on(((`bau_forum`.`hide`.`hid` = `h`.`hid`)
AND (`bau_forum`.`hide`.`uid` = '297')))
LEFT JOIN `bau_forum`.`mybb_proactivity_hide_threads` `hide_thread` on(((`bau_forum`.`hide_thread`.`tid` = `post`.`tid`)
AND (`bau_forum`.`hide_thread`.`uid` = '297')))
LEFT JOIN `bau_forum`.`mybb_proactivity_hide_forums` `hide_forum` on(((`bau_forum`.`hide_forum`.`uid` = '297')
AND (`post`.`fid` = `bau_forum`.`hide_forum`.`fid`)))
WHERE ((`p`.`hid` = `h`.`hid`)
AND (`bau_forum`.`u`.`uid` = `p`.`uid`)
AND (`post`.`pid` = `p`.`data`)
AND (`t`.`tid` = `post`.`tid`)
AND isnull(`bau_forum`.`hide`.`hid`)
AND isnull(`bau_forum`.`hide_thread`.`tid`)
AND isnull(`bau_forum`.`hide_forum`.`fid`)
AND (`bau_forum`.`u`.`uid` <> '297')
AND (`p`.`nid` <= '24751')
AND (`post`.`fid` <> '')
AND (`t`.`visible` <> 0)
AND (`post`.`visible` <> 0)
AND (`h`.`type` = 'post'))
ORDER BY `p`.`nid` DESC LIMIT 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment