diff --git a/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php b/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php
index 7ba339a8703e..8ae27b897319 100644
--- a/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php
+++ b/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php
@@ -68,11 +68,11 @@ public function apply()
             $adminStructureIds = $this->moduleDataSetup->getConnection()->fetchAssoc($adminSelect);
             foreach ($companies as $company) {
                 if (isset($adminStructureIds[$company['super_user_id']]['structure_id'])) {
+                    $structureId = (int)$adminStructureIds[$company['super_user_id']]['structure_id'];
                     $this->moduleDataSetup->getConnection()->update(
                         $this->moduleDataSetup->getTable('company_structure'),
-                        ['company_id' => $company['entity_id']],
-                        ['path REGEXP ?' =>
-                            '^' . $adminStructureIds[$company['super_user_id']]['structure_id'] . '(/.+)?$']
+                        ['company_id' => (int)$company['entity_id']],
+                        ['path LIKE \'' . $structureId . '/%\' OR path = \'' . $structureId . '\'']
                     );
                 }
             }
diff --git a/vendor/magento/module-company/etc/db_schema.xml b/vendor/magento/module-company/etc/db_schema.xml
index 7e0780146900..f50037328736 100644
--- a/vendor/magento/module-company/etc/db_schema.xml
+++ b/vendor/magento/module-company/etc/db_schema.xml
@@ -113,6 +113,9 @@
         <index referenceId="COMPANY_STRUCTURE_COMPANY_ID" indexType="btree">
             <column name="company_id"/>
         </index>
+        <index referenceId="COMPANY_STRUCTURE_PATH" indexType="btree">
+            <column name="path"/>
+        </index>
     </table>
     <table name="company_advanced_customer_entity" resource="default" engine="innodb"
            comment="company_advanced_customer_entity">
diff --git a/vendor/magento/module-company/etc/db_schema_whitelist.json b/vendor/magento/module-company/etc/db_schema_whitelist.json
index 9ddc43d4812e..678482b89f24 100644
--- a/vendor/magento/module-company/etc/db_schema_whitelist.json
+++ b/vendor/magento/module-company/etc/db_schema_whitelist.json
@@ -60,7 +60,8 @@
             "COMPANY_STRUCTURE_PARENT_ID": true,
             "COMPANY_STRUCTURE_ENTITY_ID": true,
             "COMPANY_STRUCTURE_ENTITY_TYPE": true,
-            "COMPANY_STRUCTURE_COMPANY_ID": true
+            "COMPANY_STRUCTURE_COMPANY_ID": true,
+            "COMPANY_STRUCTURE_PATH": true
         },
         "constraint": {
             "PRIMARY": true,
