Skip to content

Instantly share code, notes, and snippets.

@hughdavenport
Created February 24, 2013 19:59
Show Gist options
  • Save hughdavenport/5025337 to your computer and use it in GitHub Desktop.
Save hughdavenport/5025337 to your computer and use it in GitHub Desktop.
--- default_scope.no_time.out 2013-02-25 08:59:20.181150341 +1300
+++ no_scope.no_time.out 2013-02-25 08:59:26.893130014 +1300
@@ -14,15 +14,12 @@
D, DEBUG -- : SQL INSERT INTO "t2s" ("t1_id") VALUES (?) [["t1_id", 2]]
D, DEBUG -- : commit transaction
D, DEBUG -- : T1 Load SELECT "t1s".* FROM "t1s" WHERE "t1s"."flag" = 't'
-D, DEBUG -- : T2 Load SELECT "t2s".* FROM "t2s"
-D, DEBUG -- : T1 Load SELECT "t1s".* FROM "t1s" WHERE "t1s"."flag" = 't' AND "t1s"."id" IN (1, 2)
-D, DEBUG -- : T2 Load SELECT "t2s".* FROM "t2s" INNER JOIN "t1s" ON "t1s"."id" = "t2s"."t1_id"
-D, DEBUG -- : T1 Load SELECT "t1s".* FROM "t1s" WHERE "t1s"."flag" = 't' AND "t1s"."id" = 1 LIMIT 1
-D, DEBUG -- : T1 Load SELECT "t1s".* FROM "t1s" WHERE "t1s"."flag" = 't' AND "t1s"."id" = 2 LIMIT 1
-D, DEBUG -- : SQL SELECT "t2s"."id" AS t0_r0, "t2s"."t1_id" AS t0_r1, "t1s"."id" AS t1_r0, "t1s"."flag" AS t1_r1 FROM "t2s" INNER JOIN "t1s" ON "t1s"."id" = "t2s"."t1_id"
+D, DEBUG -- : SQL SELECT "t2s"."id" AS t0_r0, "t2s"."t1_id" AS t0_r1, "t1s"."id" AS t1_r0, "t1s"."flag" AS t1_r1 FROM "t2s" LEFT OUTER JOIN "t1s" ON "t1s"."id" = "t2s"."t1_id" WHERE "t1s"."flag" = 't'
+D, DEBUG -- : T2 Load SELECT "t2s".* FROM "t2s" INNER JOIN "t1s" ON "t1s"."id" = "t2s"."t1_id" WHERE "t1s"."flag" = 't'
+D, DEBUG -- : T1 Load SELECT "t1s".* FROM "t1s" WHERE "t1s"."id" = 2 LIMIT 1
+D, DEBUG -- : SQL SELECT "t2s"."id" AS t0_r0, "t2s"."t1_id" AS t0_r1, "t1s"."id" AS t1_r0, "t1s"."flag" AS t1_r1 FROM "t2s" INNER JOIN "t1s" ON "t1s"."id" = "t2s"."t1_id" WHERE "t1s"."flag" = 't'
Active Record 3.2.12
-- create_table(:t1s, {:force=>true})
->
-- create_table(:t2s, {:force=>true})
->
-"1 BAD (T2 select + includes T1 + joins T1)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment