SELECT does access the index directly. Checkout the at the query plan.
select * from travel-sample
.inventory.airport where airportname = ‘Albany Intl’
{
"#operator": "Authorize",
"#planPreparedTime": "2025-05-08T10:41:02.914-07:00",
"#stats": {
"#phaseSwitches": 4,
"execTime": "743ns",
"servTime": "2.054µs"
},
"privileges": {
"List": [
{
"Target": "default:travel-sample.inventory.airport",
"Priv": 7,
"Props": 0
}
]
},
"~child": {
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 2,
"execTime": "1.75µs"
},
"~children": [
{
"#operator": "IndexScan3",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 7,
"execTime": "14.616µs",
"kernTime": "1.656µs",
"servTime": "2.025003ms"
},
"bucket": "travel-sample",
"index": "def_inventory_airport_airportname", <------------------------ using this index
"index_id": "8aa68a427e5ef6fb",
"index_projection": {
"primary_key": true
},
"keyspace": "airport",
"namespace": "default",
"optimizer_estimates": {
"cardinality": 1,
"cost": 12.180133283987164,
"fr_cost": 12.180133283987164,
"size": 12
},
"scope": "inventory",
"spans": [
{
"exact": true, <----------------------------------- exact match
"range": [
{
"high": "\"Albany Intl\"",
"inclusion": 3,
"index_key": "`airportname`",
"low": "\"Albany Intl\""
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.002",
"#time_absolute": 0.002039619
},
{
"#operator": "Fetch",
"#stats": {
"#itemsIn": 1, <--------------------- one item
"#itemsOut": 1,
"#phaseSwitches": 10,
"execTime": "43.023µs",
"kernTime": "2.054953ms",
"servTime": "314.389µs"
},
"bucket": "travel-sample",
"keyspace": "airport",
"namespace": "default",
"optimizer_estimates": {
"cardinality": 1,
"cost": 24.967534071388343,
"fr_cost": 24.967534071388343,
"size": 248
},
"scope": "inventory",
"#time_normal": "00:00.000",
"#time_absolute": 0.000357412
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 1,
"execTime": "2.486µs"
},
"~children": [
{
"#operator": "Filter",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 8,
"execTime": "15.897µs",
"kernTime": "2.428284ms"
},
"condition": "((`airport`.`airportname`) = \"Albany Intl\")",
"optimizer_estimates": {
"cardinality": 1,
"cost": 24.983282087136367,
"fr_cost": 24.983282087136367,
"size": 248
},
"#time_normal": "00:00.000",
"#time_absolute": 0.000015897
},
{
"#operator": "InitialProject",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 7,
"execTime": "4.474µs",
"kernTime": "2.452348ms"
},
"discard_original": true,
"optimizer_estimates": {
"cardinality": 1,
"cost": 24.99903010288439,
"fr_cost": 24.99903010288439,
"size": 248
},
"preserve_order": true,
"result_terms": [
{
"expr": "self",
"star": true
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000004474
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000002486
},
{
"#operator": "Stream",
"#stats": {
"#itemsIn": 1,
"#itemsOut": 1,
"#phaseSwitches": 3,
"execTime": "45.881µs"
},
"optimizer_estimates": {
"cardinality": 1,
"cost": 24.99903010288439,
"fr_cost": 24.99903010288439,
"size": 248
},
"serializable": true,
"#time_normal": "00:00.000",
"#time_absolute": 0.000045881
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.00000175
},
"~versions": [
"7.6.2-N1QL",
"7.6.2-3721-enterprise"
],
"#time_normal": "00:00.000",
"#time_absolute": 0.0000020539999999999997
select * from travel-sample
.inventory.airport where airportname >= ‘Albany Intl’ and airportname <= ‘Bangor Intl’
{
"#operator": "Authorize",
"#planPreparedTime": "2025-05-08T10:47:20.423-07:00",
"#stats": {
"#phaseSwitches": 4,
"execTime": "1.066µs",
"servTime": "3.848µs"
},
"privileges": {
"List": [
{
"Target": "default:travel-sample.inventory.airport",
"Priv": 7,
"Props": 0
}
]
},
"~child": {
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 2,
"execTime": "1.865µs"
},
"~children": [
{
"#operator": "IndexScan3",
"#stats": {
"#heartbeatYields": 1,
"#itemsIn": 94,
"#itemsOut": 94,
"#phaseSwitches": 379,
"execTime": "46.95µs",
"kernTime": "45.757µs",
"servTime": "1.170633ms"
},
"bucket": "travel-sample",
"index": "def_inventory_airport_airportname", <---------------------- index
"index_id": "8aa68a427e5ef6fb",
"index_projection": {
"primary_key": true
},
"keyspace": "airport",
"namespace": "default",
"optimizer_estimates": {
"cardinality": 81.99999999999993,
"cost": 26.77092928694737,
"fr_cost": 12.180133283987164,
"size": 12
},
"scope": "inventory",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"Bangor Intl\"",
"inclusion": 3,
"index_key": "`airportname`",
"low": "\"Albany Intl\""
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.001",
"#time_absolute": 0.0012175830000000002
},
{
"#operator": "Fetch",
"#stats": {
"#heartbeatYields": 2,
"#itemsIn": 94,
"#itemsOut": 94,
"#phaseSwitches": 386,
"execTime": "244.364µs",
"kernTime": "1.308167ms",
"servTime": "4.414366ms"
},
"bucket": "travel-sample",
"keyspace": "airport",
"namespace": "default",
"optimizer_estimates": {
"cardinality": 81.99999999999993,
"cost": 103.33779385384418,
"fr_cost": 24.967534071388343,
"size": 248
},
"scope": "inventory",
"#time_normal": "00:00.004",
"#time_absolute": 0.004658730000000001
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 1,
"execTime": "7.784µs"
},
"~children": [
{
"#operator": "Filter",
"#stats": {
"#heartbeatYields": 2,
"#itemsIn": 94,
"#itemsOut": 94,
"#phaseSwitches": 380,
"execTime": "319.771µs",
"kernTime": "5.751345ms"
},
"condition": "((\"Albany Intl\" <= (`airport`.`airportname`)) and ((`airport`.`airportname`) <= \"Bangor Intl\"))",
"optimizer_estimates": {
"cardinality": 81.99999999999993,
"cost": 104.62913114518211,
"fr_cost": 24.983282087136367,
"size": 248
},
"#time_normal": "00:00.000",
"#time_absolute": 0.000319771
},
{
"#operator": "InitialProject",
"#stats": {
"#itemsIn": 94,
"#itemsOut": 94,
"#phaseSwitches": 286,
"execTime": "35.619µs",
"kernTime": "5.54178ms"
},
"discard_original": true,
"optimizer_estimates": {
"cardinality": 81.99999999999993,
"cost": 105.92046843652005,
"fr_cost": 24.99903010288439,
"size": 248
},
"preserve_order": true,
"result_terms": [
{
"expr": "self",
"star": true
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000035619
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000007784
},
{
"#operator": "Stream",
"#stats": {
"#itemsIn": 94,
"#itemsOut": 94,
"#phaseSwitches": 96,
"execTime": "989.888µs"
},
"optimizer_estimates": {
"cardinality": 81.99999999999993,
"cost": 105.92046843652005,
"fr_cost": 24.99903010288439,
"size": 248
},
"serializable": true,
"#time_normal": "00:00.000",
"#time_absolute": 0.000989888
}
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000001865
},
"~versions": [
"7.6.2-N1QL",
"7.6.2-3721-enterprise"
],
"#time_normal": "00:00.000",
"#time_absolute": 0.000004914000000000001
}