Index Servic
e가 제공CREATE PRIMARY INDEX
참조Index Service
가 제공문서 내(within)
의 속성에 기반한다scalar
, object
, 또는 array
과 같은 모든 유형이 가능GSI
Search Service
가 제공Couchbase Views
지원GSI(Global Secondary Index)
]GSI
는 Query Service
가 문서의 속성(attributes
)에 대해 생성한 쿼리를 지원한다Advanced Scaling
Predictable Performace
Low Latency Querying
Independent Partitioning
Index Service
는 분할 독립성(partition independence) 제공하여, 데이터와 그 인덱스는 서로 다른 파티션 키를 가질 수 있다Index Replication
Index Partitioning
Index Consistency
Index Snapshots
Index Rollback
GSI
ForestDB
저장 엔진 사용하여 B-Tree 인덱스 저장하고 버퍼에 최적의 작업 집합(working set)을 유지GSI
CREATE PRIMARY INDEX ON `travel-sample`;
SELECT * FROM system:indexes WHERE name = '#primary';
Results:
[
{
"indexes": {
"datastore_id": "http://127.0.0.1:8091", // 인덱스가 존재하는 곳
"id": "1b7ac1abf01d9038",
"index_key": [],
"is_primary": true,
"keyspace_id": "travel-sample",
"name": "#primary",
"namespace_id": "default",
"state": "online", // 인덱스 상태
"using": "gsi" // 인덱스 메서드
}
}
]
CREATE PRIMARY INDEX def_primary ON `travel-sample`;
scalar
, object
, 또는 array
등 모두 가능하다CREATE INDEX travel_name ON `travel-sample`(name);
# Name is a simple scalar value such as:
{
"name": "Air France"
}
CREATE INDEX travel_geo on `travel-sample`(geo);
-- geo is an object, embedded within the document such as:
"geo": {
"alt": 12,
"lat": 50.962097,
"lon": 1.954764
}
CREATE INDEX travel_geo on `travel-sample`(geo.alt);
CREATE INDEX travel_geo on `travel-sample`(geo.lat);
CREATE INDEX travel_schedule ON `travel-sample`(schedule);
-- Schedule is an array of objects with flight details.
-- This command indexes the complete array and is useful only if you're looking for the entire array.
-- Example Results:
"schedule": [
{
"day": 0,
"flight": "AF198",
"utc": "10:13:00"
},
{
"day": 0,
"flight": "AF547",
"utc": "19:14:00"
},
{
"day": 0,
"flight": "AF943",
"utc": "01:31:00"
},
{
"day": 1,
"flight": "AF356",
"utc": "12:40:00"
},
{
"day": 1,
"flight": "AF480",
"utc": "08:58:00"
},
{
"day": 1,
"flight": "AF250",
"utc": "12:59:00"
}
]
span
) 제공하며 스캔 요청Client | REST API 통해 쿼리 제출 |
SELECT
t.airportname,
t.city
FROM `tracvel-sample` t
WHERE
type = "airport" AND
tz = "America/Anchorage" AND
geo.alt >= 2100;
Query Service | 파싱, 분석, 계획 생성 |
Index Service | Scan Request; index filter |
Index Service | 한정된(qualified) 문서 키 가져오기 |
Data Service | Fetch Request, doc keys |
Data Service | Fetch Documents |
Query Service | Evaluate: Doucuments to results |
Clients | Query result(JSON) |