[ { result: 0 } ]
[ { result: 0 } ]
[ { result: 0 } ]
mdb_test2> db.aggregate([{$sql:" select plan_table_output from table(dbms_xplan.display) "}]);
[
{ PLAN_TABLE_OUTPUT: 'Plan hash value: 1915469587' },
{ PLAN_TABLE_OUTPUT: ' ' },
{
PLAN_TABLE_OUTPUT: '-----------------------------------------------------------------------------------------'
},
{
PLAN_TABLE_OUTPUT: '| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |'
},
{
PLAN_TABLE_OUTPUT: '-----------------------------------------------------------------------------------------'
},
{
PLAN_TABLE_OUTPUT: '| 0 | SELECT STATEMENT | | 1 | 174 | 2 (0)| 00:00:01 |'
},
{
PLAN_TABLE_OUTPUT: '|* 1 | TABLE ACCESS BY INDEX ROWID| employees | 1 | 174 | 2 (0)| 00:00:01 |'
},
{
PLAN_TABLE_OUTPUT: '|* 2 | INDEX UNIQUE SCAN | EMP_IDX | 1 | | 0 (0)| 00:00:01 |'
},
{
PLAN_TABLE_OUTPUT: '-----------------------------------------------------------------------------------------'
},
{ PLAN_TABLE_OUTPUT: ' ' },
{
PLAN_TABLE_OUTPUT: 'Predicate Information (identified by operation id):'
},
{
PLAN_TABLE_OUTPUT: '---------------------------------------------------'
},
{ PLAN_TABLE_OUTPUT: ' ' },
{
PLAN_TABLE_OUTPUT: ` 1 - filter(JSON_VALUE("E"."DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$.name' `
},
{
PLAN_TABLE_OUTPUT: " RETURNING VARCHAR2(4000) NULL ON ERROR TYPE(STRICT) )='Test')"
},
{
PLAN_TABLE_OUTPUT: ' 2 - access(JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '
},
{
PLAN_TABLE_OUTPUT: " '$.name.stringOnly()' RETURNING VARCHAR2(4000) ERROR ON ERROR TYPE(LAX) )='Test')"
},
{ PLAN_TABLE_OUTPUT: ' ' },
{ PLAN_TABLE_OUTPUT: 'Note' },
{ PLAN_TABLE_OUTPUT: '-----' },
{
PLAN_TABLE_OUTPUT: ' - dynamic statistics used: dynamic sampling (level=AUTO (SYSTEM))'
}
]
{
queryPlanner: {
plannerVersion: 1,
namespace: 'mdb_test2.employees',
indexFilterSet: false,
parsedQuery: { name: { '$stringOnly': 'Test' } },
rewrittenQuery: { name: { '$stringOnly': 'Test' } },
winningPlan: {
stage: 'SELECT STATEMENT',
inputStage: {
stage: 'TABLE ACCESS',
options: 'BY INDEX ROWID',
source: 'employees',
columns: `"DATA" /*+ LOB_BY_VALUE */ [JSON,8200], JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$._id' RETURNING ANY ORA_RAWCOMPARE(2000) NO ARRAY ERROR ON ERROR TYPE(LAX) )[RAW,2000], "ETAG"[RAW,16]`,
filterType: 'filter',
filter: `JSON_EXISTS2("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$?(@.name.stringOnly() == $B0)' PASSING :1 AS "B0" FALSE ON ERROR TYPE(STRICT) )=1`,
path: "$._id'",
query: "$?(@.name.stringOnly() == $B0)'",
inputStage: {
stage: 'INDEX',
options: 'UNIQUE SCAN',
source: 'EMP_IDX',
columns: `"employees".ROWID[ROWID,10], JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$.name.stringOnly()' RETURNING VARCHAR2(4000) ERROR ON ERROR TYPE(LAX) )[VARCHAR2,4000]`,
filterType: 'access',
filter: `JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$.name.stringOnly()' RETURNING VARCHAR2(4000) ERROR ON ERROR TYPE(LAX) )=:1`,
path: "$.name.stringOnly()'"
}
}
},
rejectPlans: []
},
serverInfo: { host: 'localhost', port: 27017, version: '4.2.14' },
ok: 1
}
mdb_test2>// Verify index being used using MongoDB commands from MongoShell
{
queryPlanner: {
plannerVersion: 1,
namespace: 'mdb_test2.departments',
indexFilterSet: false,
parsedQuery: { deptno: { '$numberOnly': 1 } },
rewrittenQuery: { deptno: { '$numberOnly': 1 } },
winningPlan: {
stage: 'SELECT STATEMENT',
inputStage: {
stage: 'TABLE ACCESS',
options: 'BY INDEX ROWID',
source: 'DEPARTMENTS',
columns: `"DATA" /*+ LOB_BY_VALUE */ [JSON,8200], JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$._id' RETURNING ANY ORA_RAWCOMPARE(2000) NO ARRAY ERROR ON ERROR TYPE(LAX) )[RAW,2000], "ETAG"[RAW,16]`,
filterType: 'filter',
filter: `JSON_EXISTS2("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$?(@.deptno.numberOnly() == $B0)' PASSING :1 AS "B0" FALSE ON ERROR TYPE(STRICT) )=1`,
path: "$._id'",
query: "$?(@.deptno.numberOnly() == $B0)'",
inputStage: {
stage: 'INDEX',
options: 'UNIQUE SCAN',
source: 'DEPT_IDX',
columns: `"DEPARTMENTS".ROWID[ROWID,10], JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$.deptno.number()' RETURNING NUMBER ERROR ON ERROR TYPE(LAX) )[NUMBER,22]`,
filterType: 'access',
filter: `JSON_VALUE("DATA" /*+ LOB_BY_VALUE */ FORMAT OSON , '$.deptno.number()' RETURNING NUMBER ERROR ON ERROR TYPE(LAX) )=:1`,
path: "$.deptno.number()'"
}
}
},
rejectPlans: []
},
serverInfo: { host: 'localhost', port: 27017, version: '4.2.14' },
ok: 1
}
mdb_test2>