My Products
Help
omelhus
PARTNER

Performance issues with joins

by omelhus

Hey,

 

I have this query where I include StockBalance for the products. Without the joindown the query takes 2 seconds, but with it takes 14 seconds. Any chance you will be looking to improve this?

 

Are you using dataloaders to avoid N+1 issues?

 

 

query GetProduct($cid: Int!, $includeStock: Boolean!) {
	useCompany(no: $cid) {
		product {
			totalCount
			items {
				number: productNo
				description
				information1
				information2
				information3
				information4
								
				joinup_Unit {
					unit
					description
					quantityPerUnit
				}
				joinup_ProductCategory_via_ProductCategory1 {
					productCategoryNo
					description
				}
				joinup_ProductCategory_via_ProductCategory2 {
					productCategoryNo
					description
				}
				joindown_StockBalance_via_Product @include(if: $includeStock) {
					items {
						available
						physicalStockValueDomestic
					}
				}
			}
		}
	}
}

 

 

1 REPLY 1

by Marius Bancila

Yes, we do use the dataloader.

 

I have tried the query and I get similar results. I can't really say why this is happening but will open an internal ticket and will investigate where the problem is.