cloud_controller_ng
cloud_controller_ng copied to clipboard
Eager load required fields only
Improve service plans / service offerings presenters and decorators.
The following diff shows how queries changed for the /v3/service_plans endpoint utilizing different decorators:
======================================================================================================================================================================
=== cf curl "/v3/service_plans" ===
======================================================================================================================================================================
SELECT count(*) AS "count" FROM (SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC) AS "t1" LIMIT 1
SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC LIMIT 50 OFFSET 0
SELECT * FROM "service_plan_labels" WHERE ("service_plan_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "service_plan_annotations" WHERE ("service_plan_annotations"."resource_guid" IN (<GUIDs>))
-SELECT * FROM "services" WHERE ("services"."id" IN (<IDs>))
-SELECT * FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
-SELECT * FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
+SELECT "id", "guid", "bindable", "service_broker_id" FROM "services" WHERE ("services"."id" IN (<IDs>))
+SELECT "id", "space_id" FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
+SELECT "id", "guid" FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
======================================================================================================================================================================
=== cf curl "/v3/service_plans?fields[service_offering.service_broker]=guid,name" ===
======================================================================================================================================================================
SELECT count(*) AS "count" FROM (SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC) AS "t1" LIMIT 1
SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC LIMIT 50 OFFSET 0
SELECT * FROM "service_plan_labels" WHERE ("service_plan_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "service_plan_annotations" WHERE ("service_plan_annotations"."resource_guid" IN (<GUIDs>))
-SELECT * FROM "services" WHERE ("services"."id" IN (<IDs>))
-SELECT * FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
-SELECT * FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
+SELECT "id", "guid", "bindable", "service_broker_id" FROM "services" WHERE ("services"."id" IN (<IDs>))
+SELECT "id", "space_id", "guid", "created_at", "name" FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
+SELECT "id", "guid" FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
======================================================================================================================================================================
=== cf curl "/v3/service_plans?include=service_offering" ===
======================================================================================================================================================================
SELECT count(*) AS "count" FROM (SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC) AS "t1" LIMIT 1
SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC LIMIT 50 OFFSET 0
SELECT * FROM "service_plan_labels" WHERE ("service_plan_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "service_plan_annotations" WHERE ("service_plan_annotations"."resource_guid" IN (<GUIDs>))
SELECT * FROM "services" WHERE ("services"."id" IN (<IDs>))
-SELECT * FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
-SELECT * FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
-SELECT * FROM "services" WHERE ("id" IN (<IDs>))
-SELECT * FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
+SELECT "id", "space_id", "guid" FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
+SELECT "id", "guid" FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
SELECT * FROM "service_offering_labels" WHERE ("service_offering_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "service_offering_annotations" WHERE ("service_offering_annotations"."resource_guid" IN (<GUIDs>))
======================================================================================================================================================================
=== cf curl "/v3/service_plans?include=space.organization" ===
======================================================================================================================================================================
SELECT count(*) AS "count" FROM (SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC) AS "t1" LIMIT 1
SELECT DISTINCT "service_plans".* FROM "service_plans" ORDER BY "service_plans"."id" ASC, "service_plans"."guid" ASC LIMIT 50 OFFSET 0
SELECT * FROM "service_plan_labels" WHERE ("service_plan_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "service_plan_annotations" WHERE ("service_plan_annotations"."resource_guid" IN (<GUIDs>))
-SELECT * FROM "services" WHERE ("services"."id" IN (<IDs>))
-SELECT * FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
+SELECT "id", "guid", "bindable", "service_broker_id" FROM "services" WHERE ("services"."id" IN (<IDs>))
+SELECT "id", "space_id" FROM "service_brokers" WHERE ("service_brokers"."id" IN (<IDs>))
SELECT * FROM "spaces" WHERE ("spaces"."id" IN (<IDs>))
-SELECT * FROM "spaces" WHERE ("id" IN (<IDs>)) ORDER BY "created_at"
SELECT * FROM "organizations" WHERE ("organizations"."id" IN (<IDs>))
-SELECT * FROM "organizations" WHERE ("id" IN (<IDs>)) ORDER BY "created_at"
SELECT * FROM "quota_definitions" WHERE ("quota_definitions"."id" IN (<IDs>))
SELECT * FROM "space_labels" WHERE ("space_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "space_annotations" WHERE ("space_annotations"."resource_guid" IN (<GUIDs>))
SELECT * FROM "organization_labels" WHERE ("organization_labels"."resource_guid" IN (<GUIDs>))
SELECT * FROM "organization_annotations" WHERE ("organization_annotations"."resource_guid" IN (<GUIDs>))
Thanks for contributing to cloud_controller_ng. To speed up the process of reviewing your pull request please provide us with:
-
A short explanation of the proposed change:
-
An explanation of the use cases your change solves
-
Links to any other associated PRs
-
[ ] I have reviewed the contributing guide
-
[ ] I have viewed, signed, and submitted the Contributor License Agreement
-
[ ] I have made this pull request to the
mainbranch -
[ ] I have run all the unit tests using
bundle exec rake -
[ ] I have run CF Acceptance Tests