Skip to content

Instantly share code, notes, and snippets.

@chadidi
Created June 3, 2020 21:18
Show Gist options
  • Save chadidi/d8c53d43b5e334f4a514ea2827f8fbfb to your computer and use it in GitHub Desktop.
Save chadidi/d8c53d43b5e334f4a514ea2827f8fbfb to your computer and use it in GitHub Desktop.
```
[2020-06-03 21:17:22] local.INFO: select posts.*, count(likes.id) as total_likes, count(comments.id) as total_comments, count(likes.id) + count(comments.id) as total_count from `posts` left join `likes` on `posts`.`id` = `likes`.`likable_id` and `likes`.`likable_type` = ? left join `comments` on `posts`.`id` = `comments`.`commentable_id` and `comments`.`commentable_type` = ? where `posts`.`deleted_at` is null group by `posts`.`id` order by `total_count` desc ["posts","posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [1,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [1,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [2,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [2,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [3,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [3,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [4,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [4,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [5,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [5,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [6,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [6,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [7,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [7,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [8,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [8,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [9,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [9,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [10,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [10,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [11,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [11,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [12,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [12,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [13,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [13,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [14,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [14,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `comments` where `comments`.`commentable_id` = ? and `comments`.`commentable_id` is not null and `comments`.`commentable_type` = ? and `comments`.`deleted_at` is null [15,"posts"]
[2020-06-03 21:17:22] local.INFO: select count(*) as aggregate from `users` inner join `likes` on `users`.`id` = `likes`.`user_id` where `likes`.`likable_id` = ? and `likable_type` = ? and `likes`.`deleted_at` is null and `users`.`deleted_at` is null [15,"posts"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment