Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Increased query cost for attributes (#17937)

Maciej Korycinskia204638fd6c3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b033b48eb5..1f34838b1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ All notable, unreleased changes to this project will be documented in this file.
# 3.22.0 [Unreleased]
### Breaking changes
+- Increased query cost for attribute-related operations due to the addition of `AttributeValue.referencedObject`.
### GraphQL API
diff --git a/saleor/graphql/query_cost_map.py b/saleor/graphql/query_cost_map.py
index 83ed65ddcb..d7ad2fd114 100644
--- a/saleor/graphql/query_cost_map.py
+++ b/saleor/graphql/query_cost_map.py
@@ -147,6 +147,9 @@ COST_MAP = {
"productTypes": {"complexity": 1, "multipliers": ["first", "last"]},
"productVariantTypes": {"complexity": 1, "multipliers": ["first", "last"]},
},
+ "AttributeValue": {
+ "referencedObject": {"complexity": 1},
+ },
"Category": {
"ancestors": {"complexity": 1, "multipliers": ["first", "last"]},
"children": {"complexity": 1, "multipliers": ["first", "last"]},
@@ -234,11 +237,11 @@ COST_MAP = {
"variant": {"complexity": 1},
},
"Page": {
- "attributes": {"complexity": 1},
+ "attributes": {"complexity": 100},
"pageType": {"complexity": 1},
},
"PageType": {
- "attributes": {"complexity": 1},
+ "attributes": {"complexity": 100},
"availableAttributes": {"complexity": 1, "multipliers": ["first", "last"]},
},
"Payment": {
@@ -246,7 +249,7 @@ COST_MAP = {
"transactions": {"complexity": 1},
},
"Product": {
- "attributes": {"complexity": 1},
+ "attributes": {"complexity": 100},
"category": {"complexity": 1},
"channelListings": {"complexity": 1},
"collections": {"complexity": 1},
@@ -259,7 +262,7 @@ COST_MAP = {
"pricing": {"complexity": 1},
"productType": {"complexity": 1},
"thumbnail": {"complexity": 1},
- "variants": {"complexity": 1},
+ "variants": {"complexity": 100},
"productVariants": {"complexity": 1, "multipliers": ["first", "last"]},
},
"ProductChannelListing": {
@@ -278,7 +281,7 @@ COST_MAP = {
"products": {"complexity": 1, "multipliers": ["first", "last"]},
},
"ProductVariant": {
- "attributes": {"complexity": 1},
+ "attributes": {"complexity": 100},
"channelListings": {"complexity": 1},
"images": {"complexity": 1},
"media": {"complexity": 1},