開発者は、フィルタ機能を備えたカスタムデータテーブルを Lightning Web コンポーネントに実装しました。 ただし、ユーザーはフィルターが変更されたときの長いロード時間に関するサポート チケットを送信しています。このコンポーネントは、選択したフィルタに基づいてレコードをクエリするために呼び出される Apex メソッドを使用します。 コンポーネントのパフォーマンスを向上させるために開発者は何をすべきでしょうか?
正解:B
When faced with performance issues in a Lightning Web Component (LWC) due to SOQL query load times, the optimal approach is often to improve the query's selectivity. This can be achieved by using a selective SOQL query with a custom index. Salesforce can create custom indexes to improve the performance of queries that cannot be optimized through standard indexing. When a query is selective, it can efficiently retrieve records from the database using the index, thus reducing the query execution time and speeding up the component's performance when filters are changed. The other options (returning all records, using SOSL, or client-side caching) do not directly address the root cause of the performance issue, which is the need for a more efficient database operation. References: Make SOQL Query Selective Use of Indexes in SOQL Queries