pbyrne/iswhen.info — pull request #18 by pbyrne (2013-03-31 20:44:37+00:00)
Title: Improve Performance

We're doing way too many queries to fetch the observances for the API. It's a classic N+1 issue. Including the observances when fetching the events is a simple fix.

**before**
```
Started GET "/xml-api" for 127.0.0.1 at 2013-03-31 15:32:21 -0500
Processing by XmlApiController#index as XML
Event Load (0.8ms) SELECT DISTINCT "events".* FROM "events" INNER JOIN "observances" ON "observances"."event_id" = "events"."id" WHERE (observances.start_on >= '2013-03-31')
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 174 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 190 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 206 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 175 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 176 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 205 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 177 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 178 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 179 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 180 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 181 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 182 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 183 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 204 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 184 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 185 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 186 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 187 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 188 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 189 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 191 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 203 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 192 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 193 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 194 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 195 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 202 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 201 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 196 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 200 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 197 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 198 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 199 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 203 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 174 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 193 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 186 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 197 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 194 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 187 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 178 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 180 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 198 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 205 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 175 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 184 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 185 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 199 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 201 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 204 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 181 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 189 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 177 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 179 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 182 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 192 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 200 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.1ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 188 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 190 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 191 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 196 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 202 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 183 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 176 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 206 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 195 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Rendered xml_api/index.xml.builder (132.3ms)
Completed 200 OK in 135ms (Views: 122.1ms | ActiveRecord: 12.9ms)

Started GET "/xml-api" for 127.0.0.1 at 2013-03-31 15:32:21 -0500
Processing by XmlApiController#index as XML
Event Load (0.8ms) SELECT DISTINCT "events".* FROM "events" INNER JOIN "observances" ON "observances"."event_id" = "events"."id" WHERE (observances.start_on >= '2013-03-31')
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 174 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 190 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 206 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 175 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 176 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.4ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 205 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 177 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 178 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 179 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 180 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 181 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.3ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 182 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 183 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 204 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 184 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 185 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 186 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 187 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.1ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 188 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 189 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 191 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 203 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 192 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 193 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 194 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 195 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 202 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 201 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 196 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 200 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 197 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 198 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 199 AND (start_on >= '2013-03-31') ORDER BY start_on asc LIMIT 1
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 203 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 174 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 193 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 186 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 197 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 194 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 187 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 178 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 180 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 198 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 205 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 175 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 184 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 185 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 199 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 201 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 204 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 181 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 189 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 177 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 179 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 182 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 192 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 200 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.1ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 188 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 190 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 191 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 196 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 202 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 183 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 176 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.2ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 206 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Observance Load (0.1ms) SELECT "observances".* FROM "observances" WHERE "observances"."event_id" = 195 AND (start_on >= '2013-03-31') ORDER BY start_on asc
Rendered xml_api/index.xml.builder (137.2ms)
Completed 200 OK in 140ms (Views: 126.4ms | ActiveRecord: 13.3ms)
```

**after**
```
Started GET "/xml-api" for 127.0.0.1 at 2013-03-31 15:40:47 -0500
Processing by XmlApiController#index as XML
SQL (3.6ms) SELECT DISTINCT "events"."id" AS t0_r0, "events"."name" AS t0_r1, "events"."shortname" AS t0_r2, "events"."longname" AS t0_r3, "events"."starts_sundown" AS t0_r4, "events"."created_at" AS t0_r5, "events"."updated_at" AS t0_r6, "observances"."id" AS t1_r0, "observances"."event_id" AS t1_r1, "observances"."start_on" AS t1_r2, "observances"."end_on" AS t1_r3, "observances"."created_at" AS t1_r4, "observances"."updated_at" AS t1_r5 FROM "events" LEFT OUTER JOIN "observances" ON "observances"."event_id" = "events"."id" AND start_on >= '2013-03-31' WHERE (observances.start_on >= '2013-03-31')
Rendered xml_api/index.xml.builder (105.7ms)
Completed 200 OK in 109ms (Views: 104.8ms | ActiveRecord: 3.6ms)
```