In DW 9.9.6 in a solution with two shops and 500k+ products.
When trying to build a product index, LoadVariantInfo times out on the expression:
SELECT VariantOptionsProductRelationProductID
FROM EcomVariantOptionsProductRelation LEFT JOIN EcomProducts
ON VariantOptionsProductRelationProductID = ProductID AND VariantOptionsProductRelationVariantID = ProductVariantID
WHERE ProductID IS NULL
GROUP BY VariantOptionsProductRelationProductID
The expression takes 1:10 to run, unless i remove the group by, it then executes instantly.
Shop A on the solution have 77000 entries on the VariantOptionsProductRelationProductID and shop B have 0. Even though shop B have no entries on the table its only when its products are loaded into EcomProducts. Shop B dont have any variants. If i prefix all the product ids in shop B with a random char, the expression executes instantly.
Running it with group by
Running it without group by:
Log.Log from index diagnostics:
2022-05-30 09:35:44.378: Running.
2022-05-30 09:35:44.395: Fetching build definition.
2022-05-30 09:35:44.395: Fetched build definition. 'Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder'.
2022-05-30 09:35:44.411: Preparing schema.
2022-05-30 09:35:44.411: Prepared schema.
2022-05-30 09:35:44.426: Creating index writer.
2022-05-30 09:35:44.426: Created index writer: 'Dynamicweb.Indexing.Lucene.LuceneIndexWriter'.
2022-05-30 09:35:44.441: Instance availability (B): False.
2022-05-30 09:35:44.441: Starting build process.
2022-05-30 09:35:44.457: Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder building using Dynamicweb.Indexing.Lucene.LuceneIndexWriter... Action: 'Full', Resume: 'False'
2022-05-30 09:35:44.457: Opening index writer.
2022-05-30 09:35:44.545: Opened index writer to overwrite index
2022-05-30 09:35:44.545: Opening database connection.
2022-05-30 09:35:44.556: BulkSize: '500'
2022-05-30 09:35:44.556: MaxProductsToIndex: '2147483647'
2022-05-30 09:35:44.566: OnlyIndexActiveProducts: 'True'
2022-05-30 09:35:44.566: SkipGrouping: 'False'
2022-05-30 09:35:44.566: SkipGroupSorting: 'True'
2022-05-30 09:35:44.586: SkipRelatedProducts: 'True'
2022-05-30 09:35:44.586: SkipExtenders: 'True'
2022-05-30 09:35:44.598: SkipAllExtendedFields: 'True'
2022-05-30 09:35:44.598: SkipCategoryFields: 'True'
2022-05-30 09:35:44.598: HandleInheritedCategoryValues: 'True'
2022-05-30 09:35:44.616: DoNotStoreDefaultFields: 'False'
2022-05-30 09:35:44.616: DoNotAnalyzeDefaultFields: 'False'
2022-05-30 09:35:44.629: EmptyStringReplacement: ''
2022-05-30 09:35:44.629: SkipImages: 'True'
2022-05-30 09:35:44.629: ShopsToIndex: ''
2022-05-30 09:35:44.647: SkipPrices: 'True'
2022-05-30 09:35:44.647: SkipDetailImages: 'True'
2022-05-30 09:35:44.660: SkipImagePatternImages: 'True'
2022-05-30 09:35:45.138: Loading product group relation information.
2022-05-30 09:36:33.924: Loaded product group relation information.
2022-05-30 09:36:33.924: Loading group relation information.
2022-05-30 09:36:33.971: Loaded group relation information.
2022-05-30 09:36:33.971: Loading product group relation information.
2022-05-30 09:36:34.015: Loaded product group relation information.
2022-05-30 09:36:34.019: Loading product groups.
2022-05-30 09:36:34.059: Loaded product groups.
2022-05-30 09:36:34.059: Loading campaign information.
2022-05-30 09:36:34.099: Loaded campaign information.
2022-05-30 09:36:34.099: Loading variant information.
2022-05-30 09:37:07.541: Product index builder experienced a fatal error.. System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader() at Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder.LoadVariantInfo(SqlConnection connection, Tracker tracker) at Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder.Build(IIndexWriter writer, Tracker tracker) ClientConnectionId:9ba05bfd-5be5-475a-bcd7-7b65ea56eff7 Error Number:-2,State:0,Class:11
2022-05-30 09:37:07.541: Product index builder experienced a fatal error.
2022-05-30 09:37:07.595: Failed (0 / 552794).
2022-05-30 09:37:07.596: indexer.Build(writer, tracker) failed. tracker.Status.State = tracking dot state dot failed.
2022-05-30 09:37:07.596: Closing index writer, just trying...
2022-05-30 09:37:07.642: Closed index writer successfully.