ACSD-47027: slow query B2B [!UICONTROL CompanyRole] [!DNL GraphQL] update
The ACSD-47027 patch solves the issue where the slow query B2B [!UICONTROL CompanyRole] [!DNL GraphQL] update does not work as expected. This patch is available when the [!DNL Quality Patches Tool (QPT)] 1.1.23 is installed. The patch ID is ACSD-47027. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.6.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.2-p1
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.2 - 2.4.5-p1
The patch might become applicable to other versions with new [!DNL Quality Patches Tool] releases. To check if the patch is compatible with your Adobe Commerce version, update the
magento/quality-patches package to the latest version and check the compatibility on the [!DNL Quality Patches Tool]: Search for patches page. Use the patch ID as a search keyword to locate the patch.
The slow query B2B [!UICONTROL CompanyRole] [!DNL GraphQL] update does not work as expected.
Install the B2B module.
Steps to reproduce:
In the Adobe Commerce Admin, go to [!UICONTROL Stores] > [!UICONTROL Settings] > [!UICONTROL Configurations] > [!UICONTROL B2B Features] and set [!UICONTROL Enable Company] to Yes.
Go to the frontend and create a company.
After you log in as a company user, go to [!UICONTROL My Account] > [!UICONTROL Roles and Permissions] and add a new role.
Enable [!UICONTROL dev] query log using
Now send the below [!DNL GraphQL] request (id is the [!UICONTROL base64] encoded role id):
Check the query log.
You can see that the above query is executed. This query is executed in
app/code/Magento/CompanyGraphQl/Model/Company/Role/ValidateRole.php::validateResources needs to be optimized to avoid loading all the data available in the [!UICONTROL company_permissions] DB table.
Adobe Commerce executes a query without any filter. When there are a large number of records, it takes a lot of time for Adobe Commerce to prepare the data collection.
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
To learn more about [!DNL Quality Patches Tool], refer to:
For info about other patches available in QPT, refer to [!DNL Quality Patches Tool]: Search for patches in the [!DNL Quality Patches Tool] guide.