[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[[["\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)"]]