Glenn Justo Galvizo created ASTERIXDB-3209:
----------------------------------------------

             Summary: CBO Not Picking Up Index (for Equality Pred)
                 Key: ASTERIXDB-3209
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3209
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
            Reporter: Glenn Justo Galvizo


Using a dataset of 2,000,000 records and a highly selective predicate, the 
index we create does not get used by CBO – it looks like CBO is considering the 
index, but choosing not to use it.

 
{code:java}
DROP DATAVERSE TestDataverse IF EXISTS;
CREATE DATAVERSE TestDataverse;
USE TestDataverse;
CREATE TYPE TypeR AS {
  id: bigint,
  f1: bigint,
  f2: bigint,
  f3: bigint,
  f4: bigint,
  st: string,
  fk: bigint
};
CREATE DATASET R (TypeR) PRIMARY KEY id;
LOAD DATASET R USING 
localfs(("path"="localhost:///.../R.json"),("format"="json"));
CREATE INDEX rFkIndex ON R (fk);
ANALYZE DATASET R;
SELECT * FROM R WHERE R.fk = 1000; {code}
We see the same plan (i.e. no index) chosen when "fk" is not defined in TypeR.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to