You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tl...@apache.org on 2022/03/09 13:08:15 UTC

[ignite-3] branch ignite-14925-sorted-indexes updated: IGNITE-14927 Change the index cost model (#701)

This is an automated email from the ASF dual-hosted git repository.

tledkov pushed a commit to branch ignite-14925-sorted-indexes
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/ignite-14925-sorted-indexes by this push:
     new 0b722e2  IGNITE-14927 Change the index cost model (#701)
0b722e2 is described below

commit 0b722e2c2b329957c2e2ecc819ea3c2176034e58
Author: Taras Ledkov <tl...@gridgain.com>
AuthorDate: Wed Mar 9 16:08:06 2022 +0300

    IGNITE-14927 Change the index cost model (#701)
---
 .../apache/ignite/internal/sql/engine/metadata/cost/IgniteCost.java    | 3 +++
 .../org/apache/ignite/internal/sql/engine/rel/AbstractIndexScan.java   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/cost/IgniteCost.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/cost/IgniteCost.java
index 3f68597..9c95907 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/cost/IgniteCost.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/cost/IgniteCost.java
@@ -42,6 +42,9 @@ public class IgniteCost implements RelOptCost {
     /** Cost of a lookup at the hash. */
     public static final double HASH_LOOKUP_COST = 10;
 
+    /** Cost of a lookup by PK. */
+    public static final double PK_LOOKUP_COST = 20;
+
     /**
      * With broadcast distribution each row will be sent to the each distination node, thus the total bytes amount will
      * be multiplies of the destination nodes count. Right now it's just a const.
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/AbstractIndexScan.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/AbstractIndexScan.java
index 47acb90..4a67b62 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/AbstractIndexScan.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/AbstractIndexScan.java
@@ -156,7 +156,7 @@ public abstract class AbstractIndexScan extends ProjectableFilterableTableScan {
                 rows = 1;
             }
 
-            cost += rows * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST);
+            cost += rows * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST + IgniteCost.PK_LOOKUP_COST);
         }
 
         // additional tiny cost for preventing equality with table scan.