항목 페이지에서 SELECT * FROM __Stat_Kind__ 형식으로 GQL 쿼리를 실행합니다.
Datastore API를 사용하여 항목의 특정 이름을 쿼리하면 애플리케이션 내부에서 프로그래매틱 방식으로 통계를 확인할 수 있습니다. Datastore API에 대한 자세한 내용은 API 및 참조를 참조하세요.
Datastore는 두 개의 밑줄로 시작하고 끝나는 종류 이름을 사용하여 데이터에 관한 통계를 제공하는 특수 항목을 식별합니다. 이를 통계 항목이라고 합니다. 예를 들어 각 앱에는 Datastore 모드 데이터베이스의 모든 항목에 대한 통계를 나타내는 __Stat_Total__ 종류 항목이 하나 있습니다.
통계 항목은 데이터에 관한 정보를 추적하고 데이터 사용에 관한 통계를 제공합니다. 이는 자동으로 생성됩니다. 각 통계 항목에는 다음과 같은 속성이 있습니다.
count: 통계에서 인식된 항목 수(긴 정수)
bytes: 이 통계 항목의 총 크기(긴 정수)
timestamp: 통계가 최근 업데이트된 시간(날짜-시간 값)
각 항목은 특정 종류에 속합니다. 통계 종류는 수집되거나 사용되는 통계의 카테고리를 나타냅니다. 종류를 사용하여 쿼리 최적화, 성능 개선, 데이터 분석과 같은 통계의 목적을 식별합니다.
통계 시스템에서 새로운 통계 항목을 생성한다고 이전 통계 항목이 즉시 삭제되는 것은 아닙니다. 통계 보기의 일관성을 유지하는 가장 좋은 방법은 최신 timestamp로 통계 항목을 쿼리한 후 다른 통계 항목을 가져올 때 해당 타임스탬프 값을 필터로 사용하는 것입니다.
통계 시스템은 각 네임스페이스별 통계도 생성합니다. 네임스페이스별 통계의 종류 이름은 __Stat_Ns__로 시작하고 애플리케이션 전체에 적용되는 통계의 종류 이름과 동일한 서픽스로 끝납니다.
애플리케이션이 네임스페이스를 사용하지 않으면 통계 시스템에서 네임스페이스별 통계를 생성하지 않습니다. 네임스페이스별 통계는 관련 네임스페이스에서만 확인할 수 있습니다.
통계 목록
사용 가능한 통계 목록은 다음과 같습니다.
통계
통계 항목 종류
설명
모든 항목
__Stat_Total__ 네임스페이스별 항목: __Stat_Ns_Total__
모든 항목. 추가 속성:
• entity_bytes: 바이트 단위로 측정된 항목 테이블의 저장용량 • builtin_index_bytes: 바이트 단위로 측정된 내장 색인 항목의 저장용량 • builtin_index_count: 내장 색인 항목 수 • composite_index_bytes: 바이트 단위로 측정된 복합 색인 항목의 저장용량 • composite_index_count: 복합 색인 항목 수
네임스페이스의 모든 항목
__Stat_Namespace__ __Stat_Namespace__ 항목은 각 네임스페이스에 대해 생성되며 비어 있는 문자열 네임스페이스에서만 확인됩니다.
네임스페이스의 모든 항목
• subject_namespace: 나타내는 네임스페이스(문자열) • entity_bytes바이트 단위로 측정된 항목 테이블의 저장용량 • builtin_index_bytes: 바이트 단위로 측정된 내장 색인 항목의 저장용량 • builtin_index_count: 내장 색인 항목 수 • composite_index_bytes: 바이트 단위로 측정된 복합 색인 항목의 저장용량 • composite_index_count: 복합 색인 항목 수
• alphanumeric_id: 색인의 영숫자 식별자입니다. gcloud 및 API에서 사용되는 동일한 식별자 • index_id: 색인 ID의 내부 정수 표현입니다. gcloud 및 API 메서드의 경우 alphanumeric_id을 대신 사용하세요. • kind_name: 나타내는 종류 이름 (문자열) • last_known_usage_timestamp: 이 색인이 마지막으로 쿼리를 제공한 시간입니다. 항상 stat_tracked_since_time과 타임스탬프 사이의 시간입니다. 해당 기간에 사용량이 기록되지 않은 경우 null로 설정합니다. __Stat_Ns_Kind_CompositeIndex__에는 표시되지 않습니다. • stat_tracked_since_time: 색인 사용량이 알려진 기간의 시작입니다. __Stat_Ns_Kind_CompositeIndex__에는 표시되지 않습니다.
기본 제공 색인의 모든 항목
__Stat_Kind_BuiltinIndex__
데이터베이스의 기본 제공 색인에 관한 정보입니다. 기본 제공 색인별 하나의 통계 항목 추가 속성:
• property_name: 색인이 지정된 속성의 이름 • kind_name: 나타내는 종류 이름 (문자열) • api_scope: Firestore 또는 Datastore • query_scope: 색인 쿼리 범위 Datastore 데이터베이스의 경우 항상 COLLECTION_GROUP (종류)로 설정합니다. • value_mode: 쿼리 범위의 모드입니다(예: ASC 또는 DESC). • last_known_usage_timestamp: 이 색인이 쿼리를 제공한 마지막 시간입니다. 항상 stat_tracked_since_time과 타임스탬프 사이의 시간입니다. 해당 기간에 사용량이 기록되지 않은 경우 null로 설정합니다. • stat_tracked_since_time: 색인 사용량이 알려진 기간의 시작입니다.
종류 항목
__Stat_Kind__ 네임스페이스별 항목: __Stat_Ns_Kind__
종류의 항목(저장된 각 항목 종류당 하나의 통계 항목) 추가 속성:
• kind_name: 나타내는 종류 이름(문자열) • entity_bytes: 바이트 단위로 측정된 항목 테이블의 저장용량 • builtin_index_bytes: 바이트 단위로 측정된 내장 색인 항목의 저장용량 • builtin_index_count: 내장 색인 항목 수 • composite_index_bytes: 바이트 단위로 측정된 복합 색인 항목의 저장용량 • composite_index_count: 복합 색인 항목 수
특정 종류 항목 전반에 적용되는 값 유형 속성(값 유형 및 종류 조합당 하나의 통계 항목).
추가 속성:
• property_type: 값 유형 이름(문자열) • kind_name: 나타내는 종류 이름(문자열) • entity_bytes: 바이트 단위로 측정된 항목 테이블의 저장용량 • builtin_index_bytes: 바이트 단위로 측정된 내장 색인의 저장용량 • builtin_index_count: 내장 색인 항목 수
특정 종류의 항목 전반에 이름을 지정하는 속성(고유한 속성 이름 및 종류 조합당 하나의 통계 항목). 추가 속성:
• property_name: 속성 이름(문자열) • kind_name: 나타내는 종류 이름(문자열) • entity_bytes: 바이트 단위로 측정된 항목 테이블의 저장용량 • builtin_index_bytes: 바이트 단위로 측정된 내장 색인 항목의 저장용량 • builtin_index_count: 내장 색인 항목 수
특정 종류 항목 전반에 특정 이름 및 특정 값 유형을 적용하는 속성(데이터베이스에 존재하는 속성 이름, 값 유형, 종류 조합당 하나의 통계 항목).
추가 속성:
• property_type: 값 유형 이름 (문자열) • property_name: 속성 이름 (문자열) • kind_name: 나타내는 종류 이름(문자열) • entity_bytes: 바이트 단위로 측정된 항목 테이블의 저장용량 • builtin_index_bytes: 바이트 단위로 측정된 내장 색인 항목의 저장용량 • builtin_index_count: 내장 색인 항목 수
__Stat_PropertyType_Kind__ 속성과 __Stat_PropertyType_PropertyName_Kind__ 속성은 array 값 유형의 속성 유형 메타데이터를 반환하고 배열의 각 값에 대한 속성 유형을 별도로 기록합니다. 예를 들어 배열 속성에 문자열 목록이 저장된 경우 속성은 속성 유형을 STRING으로 기록하지만 실제 속성 유형은 ARRAY<STRING>입니다.
__Stat_Namespace__ 항목에는 __Stat_Ns_Total__ 레코드에 있는 동일한 정보가 포함되어 있습니다. __Stat_Namespace__ 항목은 빈 네임스페이스에 저장되며 소속된 네임스페이스를 설명하는 subject_namespace 필드를 포함합니다. __Stat_Ns_Total__ 레코드는 참조하는 네임스페이스에 저장되므로 subject_namespace 필드를 포함하지 않습니다. 따라서 bytes를 기준으로 내림차순으로 정렬된 __Stat_Namespace__ 종류에 대한 쿼리 (빈 문자열 네임스페이스)는 가장 많은 저장용량을 사용하는 네임스페이스를 먼저 나열합니다. 네임스페이스 전체에 대한 쿼리는 불가능하므로 __Stat_Ns_Total__ 항목에 대한 쿼리는 많아야 1개의 레코드를 생성합니다.
통계 항목 삭제 순서
수천 개의 네임스페이스, 종류 또는 속성 이름이 포함된 애플리케이션에는 수많은 통계 항목이 필요합니다. 통계를 저장하고 업데이트하는 오버헤드를 줄이기 위해 Datastore 모드의 Firestore 데이터베이스는 나중에 나열된 순서에 따라 통계 항목을 점진적으로 삭제합니다.
요약 통계 항목 __Stat_Kind_CompositeIndex__, __Stat_PropertyType__, __Stat_Total__은 절대 삭제되지 않습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-03(UTC)"],[[["\u003cp\u003eDatastore provides statistics entities that track data usage, such as the number of entities and storage space used, offering insights into how your data is organized and utilized.\u003c/p\u003e\n"],["\u003cp\u003eStatistics entities have properties like \u003ccode\u003ecount\u003c/code\u003e, \u003ccode\u003ebytes\u003c/code\u003e, and \u003ccode\u003etimestamp\u003c/code\u003e to quantify data usage, and they can be accessed via the Google Cloud console or programmatically using the Datastore API.\u003c/p\u003e\n"],["\u003cp\u003eDifferent statistics kinds exist to categorize and specify the purpose of the data collected, for example there is a statistic for all entities, entities in a namespace, or entities of a kind, etc, including namespace-specific versions.\u003c/p\u003e\n"],["\u003cp\u003eCertain statistics entities, like \u003ccode\u003e__Stat_Kind_CompositeIndex__\u003c/code\u003e, \u003ccode\u003e__Stat_PropertyType__\u003c/code\u003e, and \u003ccode\u003e__Stat_Total__\u003c/code\u003e, are never dropped, while others are progressively removed in a specific order to manage storage overhead.\u003c/p\u003e\n"],["\u003cp\u003eThe properties \u003ccode\u003e__Stat_PropertyType_Kind__\u003c/code\u003e and \u003ccode\u003e__Stat_PropertyType_PropertyName_Kind__\u003c/code\u003e return property type metadata for array value types, separately recording the property type for each value in the array.\u003c/p\u003e\n"]]],[],null,["# Datastore statistics\n\nFirestore in Datastore mode (Datastore) maintains statistics about the data that you store in an\napplication, such as how many entities there are, of what kind, or how much\nspace is used by property values of a given type.\n\nYou can view these statistics in the Google Cloud console in one of the\nfollowing ways:\n\n- On the [Dashboard](https://console.cloud.google.com/project/_/datastore/stats) page.\n- On the [Entities](https://console.cloud.google.com/project/_/datastore/entities/query/gql) page, run a GQL query in the form of `SELECT * FROM __Stat_Kind__`.\n- Programmatically within the application by querying for specially named entities using the Datastore API. For more information about the Datastore API, see [APIs \\& Reference](/datastore/docs/apis).\n\nDatastore uses *kind names* that begin and end with two underscores to\nidentify special entities that provide statistics about your data. These are\ncalled *statistics entities* . For example, each app has one entity of the kind\n`__Stat_Total__`, which represents statistics about all of the entities in a\nDatastore mode database.\n\nStatistics entities track information about your data and give you insights into\nyour data usage. They are automatically created. Each statistic entity has the\nfollowing properties:\n\n- `count`: the number of items considered by the statistic (a long integer)\n- `bytes`: the total size of the items for this statistic (a long integer)\n- `timestamp`: the time of the most recent update to the statistic (a date-time value)\n\nEach entity belongs to a specific kind. *Statistics kind* indicates the category\nof statistics being collected or used. Use the kind to identify the purpose of a\nstatistic, such as optimizing a query, improving performance, or data analysis.\n\nSome statistic kinds also have additional properties listed in the [List of\nstatistics](#stats-list) section of this document.\n\nWhen the statistics system creates new statistic entities, it doesn't delete\nthe previous statistic entities right away. The best way to get a consistent view of\nthe statistics is to query for the statistic entity with the most recent `timestamp`, then use that\ntimestamp value as a filter when you fetch other statistic entities.\n\nThe statistics system also creates statistics that are specific to each namespace. The kind names of namespace-specific statistics are\nprefixed with `__Stat_Ns__`, followed by the same suffixes as the kind names of\nstatistics that apply to the whole application.\n\nIf an application doesn't use namespaces, the statistics system won't create\nnamespace-specific statistics. You can only find namespace-specific statistics\nin the namespace that they're relevant to.\n\nList of statistics\n------------------\n\nThe following is a list of available statistics:\n\nSome statistics refer to property value types by name, as strings. These names are as follows:\n\n- `\"Blob\"`\n- `\"BlobKey\"`\n- `\"Boolean\"`\n- `\"Category\"`\n- `\"Date/Time\"`\n- `\"Email\"`\n- `\"Float\"`\n- `\"GeoPt\"`\n- `\"IM\"`\n- `\"Integer\"`\n- `\"Key\"`\n- `\"Link\"`\n- `\"NULL\"`\n- `\"PhoneNumber\"`\n- `\"PostalAddress\"`\n- `\"Rating\"`\n- `\"ShortBlob\"`\n- `\"String\"`\n- `\"Text\"`\n- `\"User\"`\n\nStatistics limitations\n----------------------\n\nStatistics have the following limitations:\n\n- The `__Stat_PropertyType_Kind__` property and the `__Stat_PropertyType_PropertyName_Kind__` property return property type metadata for [array](/datastore/docs/concepts/entities#array) value types, and separately record the property type for each value in the array. For example, if an array property stores a list of strings, the property records the property type as `STRING`, while the actual property type is `ARRAY\u003cSTRING\u003e`.\n- The `__Stat_Namespace__` entities contain the same information found in `__Stat_Ns_Total__` records. `__Stat_Namespace__` entities are stored in the empty namespace and contain a `subject_namespace` field describing the namespace to which they belong. `__Stat_Ns_Total__` records are stored in the namespace to which they refer, and thus don't contain a `subject_namespace` field. Hence, a query on kind `__Stat_Namespace__` (from the empty string namespace) ordered descending by `bytes` will list the namespaces that consume the largest storage first. Since queries across namespaces are not possible, any query for `__Stat_Ns_Total__` entities will only ever produce at most a single record.\n\nStatistics entities drop order\n------------------------------\n\nApplications with thousands of namespaces, kinds, or property names require\na large number of statistics entities. To reduce the overhead of storing\nand updating the statistics, Firestore in Datastore mode databases progressively\ndrop statistics entities according to the order listed later.\n\nThe summary statistics entities `__Stat_Kind_CompositeIndex__`, `__Stat_PropertyType__`,\nand `__Stat_Total__` are never dropped.\n\nStatistics entities are dropped in groups in the following default order:\n\n1. per-namespace, per-kind, and per-property statistics:\n\n - `__Stat_Ns_PropertyName_Kind__`\n - `__Stat_Ns_PropertyType_PropertyName_Kind__`\n2. per-kind and per-property statistics\n\n - `__Stat_PropertyName_Kind__`\n - `__Stat_PropertyType_PropertyName_Kind__`\n3. per-namespace statistics\n\n - `__Stat_Namespace__`\n - `__Stat_Ns_Kind_CompositeIndex__`\n - `__Stat_Ns_PropertyType__`\n - `__Stat_Ns_Total__`\n\nKind statistics entities have the following drop order:\n\n1. per-namespace, per-kind statistics\n\n - `__Stat_Ns_Kind__`\n - `__Stat_Ns_Kind_IsRootEntity__`\n - `__Stat_Ns_Kind_NotRootEntity__`\n - `__Stat_Ns_PropertyType_Kind__`\n2. per-kind statistics\n\n - `__Stat_Kind__`\n - `__Stat_Kind_IsRootEntity__`\n - `__Stat_Kind_NotRootEntity__`\n - `__Stat_PropertyType_Kind__`\n\nWhat's next\n-----------\n\n- [Locating quota usage information](/datastore/docs/pricing#locating_quota_usage_information_for_your_app)"]]