이 페이지에는 가장 일반적인 시나리오에서 청구 단위가 계산되는 방법의 예가 포함되어 있습니다. 각 쿼리는 쿼리 계획, 데이터 형태, 사용 가능한 색인과 같은 요인에 따라 처리되는 데이터가 다를 수 있습니다.
Query Explain 기능을 사용하여 특정 쿼리의 비용과 성능을 더 잘 파악하는 것이 좋습니다.
읽기 작업
대부분의 읽기 작업은 특정 문서의 포인트 읽기를 수행하거나 식별자를 기반으로 데이터 범위를 스캔하는 것을 포함합니다.
읽기 작업은 읽기 단위를 사용합니다. 읽기 단위는 4KiB 단위로 계산됩니다. 다음 예시를 참조하세요.
포인트 읽기
포인트 읽기에 대한 결제의 예는 다음과 같습니다.
단일 1KiB 문서의 포인트 읽기. 사용량: 읽기 단위 1개
단일 4KiB 문서의 포인트 읽기. 사용량: 읽기 단위 1개
단일 1MiB 문서의 포인트 읽기. 사용량: 읽기 단위 256개
각각 1KiB인 문서 100개의 포인트 읽기. 사용량: 읽기 단위 100개
스캔
다음 예에는 문서 또는 색인 항목을 검색하는 시나리오가 포함되어 있습니다.
문서 스캔
각각 1KiB인 문서 100개를 스캔하는 쿼리. 사용량: 읽기 단위 25개
색인 스캔
바이트로 표시되는 스캔 비용은 스캔되는 항목이 문서인지 색인인지에 관계없이 동일합니다. 하지만 색인 항목은 크기가 더 작은 경우가 많습니다. 따라서 데이터 스캔에 더 비용 효율적인 방법을 제공할 수 있습니다.
각각 1KiB인 색인 항목 100개를 스캔하는 쿼리. 사용량: 읽기 단위 25개
각각 128바이트인 색인 항목 100개를 스캔하는 쿼리. 사용량: 읽기 단위 4개
최소 문서 또는 색인 항목 크기
특정 상황에서는 쿼리를 충족하기 위해 문서 또는 색인 항목의 콘텐츠를 읽지 않아도 될 수 있습니다. 여기에는 컬렉션의 총 문서 수를 집계하는 것과 같은 간단한 집계 쿼리가 포함됩니다.
이러한 경우 스캔된 항목당 최소 비용 32바이트가 적용됩니다.
컬렉션의 문서 수를 계산합니다. 이 쿼리는 컬렉션에서 1,000개의 항목을 스캔합니다. 사용량: 읽기 단위 8개
스캔과 포인트 읽기의 조합
많은 쿼리가 작업을 충족하기 위해 스캔과 포인트 읽기를 조합하여 수행합니다.
각각 256바이트인 색인 항목 128개를 스캔하고 각각 4KiB인 문서 128개의 포인트 읽기를 수행하는 쿼리. 사용량: 읽기 단위 136개(다음으로 구성됨)
포인트 읽기의 경우 읽기 단위 128개
색인 스캔의 경우 읽기 단위 8개
쿼리 설명
Query Explain은 데이터베이스가 쿼리를 실행하는 방식을 이해하는 데 도움이 됩니다. 제공된 세부정보를 통해 쿼리를 최적화할 수 있습니다.
Query Explain을 사용할 때는 다음 비용이 적용됩니다.
쿼리를 실행하는 Query Explain: 쿼리 비용이 적용됩니다.
계획만 옵션을 사용한 Query Explain. 사용량: 읽기 단위 1개(쿼리의 최소 비용)
쓰기 작업
쓰기 작업(생성, 업데이트, 삭제)은 작업 중에 생성, 수정 또는 삭제되는 문서 및 색인의 크기에 따라 요금이 청구됩니다. 쓰기 작업은 쓰기 단위를 사용합니다. 쓰기 단위는 1KiB 단위로 계산됩니다.
문서 ID별 업데이트와 같은 간단한 쓰기 작업에는 쓰기 비용만 발생합니다.
작업을 충족하기 위해 쿼리가 필요한 쓰기 작업에는 쿼리와 관련된 읽기 비용이 추가로 발생합니다.
다음 예시를 참조하세요.
생성
색인이 없는 새 10KiB 문서를 만듭니다. 사용량: 쓰기 단위 10개
컬렉션에 256바이트의 색인 항목이 하나 있는 1KiB 문서를 만듭니다. 사용량: 쓰기 단위 2개
업데이트
문서 ID로 10KiB 문서를 찾아 컬렉션에 색인이 없는 상태로 업데이트합니다. 사용량: 쓰기 단위 10개
문서 ID로 1KiB 문서를 찾아 256바이트의 색인 항목 1개로 필드 1개를 업데이트합니다. 사용량: 쓰기 단위 3개. 참고: 이 상황에서 색인 항목을 업데이트하면 쓰기 단위 2개가 사용됩니다. 하나는 색인 항목을 삭제하는 데 사용되고 다른 하나는 색인 항목을 다시 만드는 데 사용됩니다.
문서 ID로 1KiB 문서를 찾아 변경사항 없이 업데이트합니다. 사용량: 쓰기 단위 1개(최소 쓰기 비용)
컬렉션에서 1,000개의 문서를 스캔하는 모든 1KiB 문서를 쿼리하고 컬렉션에 색인이 없는 새 256바이트 필드를 삽입합니다. 사용량: 읽기 단위 1,000개 및 쓰기 단위 1,000개
삭제
컬렉션에 색인이 1개 있는 1KiB 문서를 삭제합니다. 사용량: 쓰기 단위 2개
컬렉션에 색인이 없는 1KiB 문서를 삭제합니다. 사용량: 쓰기 단위 1개
색인 빌드
색인 빌드는 빌드 작업 중에 생성되거나 수정된 색인 항목에 대해 요금이 청구됩니다. 이러한 비용은 색인 정의가 추가되거나 삭제될 때마다 발생합니다. 색인 항목은 1KiB당 1개의 쓰기 단위가 발생하는 쓰기와 동일하게 청구됩니다.
문서 500개가 포함된 컬렉션의 새 색인을 만듭니다. 생성된 색인 항목은 각각 1KiB입니다. 사용량: 쓰기 단위 500개.
문서 500개가 포함된 컬렉션의 기존 색인을 삭제합니다. 삭제된 색인 항목은 각각 1KiB입니다. 사용량: 쓰기 단위 500개.
[[["이해하기 쉬움","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-04(UTC)"],[],[],null,["# Pricing examples\n================\n\nThis page includes examples of how billing units are calculated in\nsome of the most common scenarios. Note that each query might differ in data\nprocessed based on factors such as the query plan, the shape of the data,\nand the indexes available.\n\nWe recommend using the [Query Explain](/firestore/mongodb-compatibility/docs/query-explain) feature to better\nunderstand the cost and performance of your specific queries.\n\nRead operations\n---------------\n\nMost read operations entail either performing a point read of a specific\ndocument or scanning a rage of data based on an identifier.\nRead operations consume read units. Read units are calculated in 4 KiB tranches. See the following examples.\n\n### Point reads\n\nExample billing for point reads:\n\n- Point read of a single 1 KiB document. Consumes: 1 read unit\n- Point read of a single 4 KiB document. Consumes: 1 read unit\n- Point read of a single 1 MiB document. Consumes: 256 read units\n- Point read of 100 documents, 1 KiB each. Consumes: 100 read units\n\n### Scanning\n\nThe following examples include scenarios that scan documents or index entries.\n\n#### Scanning Documents\n\n- Query which scans 100 documents, 1 KiB each. Consumes: 25 read units\n\n#### Scanning indexes\n\nThe scanning cost, in terms of bytes, is the same regardless of whether it is a\ndocument or index being scanned. However, index entries are often smaller\nin size. As a result, they can often provide a more cost effective way of scanning data.\n\n- Query which scans 100 index entries, 1 KiB each. Consumes: 25 read units.\n- Query which scans 100 index entries, 128 bytes each. Consumes: 4 read units.\n\n### Minimum document or index entry size\n\nIn certain situations it may not be necessary to read the contents of a\ndocument or index entry to satisfy a query. This includes simple count queries\nlike counting the total number of documents in a collection.\nIn these situations, a minimum cost of 32 bytes applies per item scanned.\n\n- Count the number of documents in a collection. The query scans 1000 items in the collection. Consumes: 8 read units.\n\n### Combination of scanning and point reads\n\nMany queries perform a combination of scanning and point reads to satisfy an\noperation.\n\n- Query which scans 128 index entries, 256 bytes each and performs a point read of 128 documents, 4 KiB each. Consumes: 136 read units, comprised of:\n - 128 read units for point reads\n - 8 read units for index scans\n\n### Query Explain\n\n[Query Explain](/firestore/mongodb-compatibility/docs/query-explain) helps you understand how the database\nexecutes your queries. The details provided can help you optimize your\nqueries.\n\nThe following costs apply when using Query Explain:\n\n- Query Explain which executes the query: Query cost applies.\n- Query Explain using plan only option. Consumes: 1 read unit (minimum cost of a query)\n\nWrite operations\n----------------\n\nWrite operations (creates, updates and deletes) are charged based on the\nsize of the documents and indexes being created, modified, or deleted during the\noperation. Write operations consume write units. Write units are calculated in 1\nKiB tranches.\n\nSimple write operations, like update by document ID, only incur the cost of the writes.\nWrite operations which require querying to satisfy the operation will\nadditionally incur the read costs associated with the query.\n\nSee the following examples.\n\n### Creates\n\n- Create a new 10 KiB document with no indexes. Consumes: 10 write units\n- Create a 1 KiB document with 1 index entry of 256 bytes on the collection. Consumes: 2 write units\n\n### Updates\n\n- Find a 10 KiB document by document ID and update with no indexes on the collection. Consumes: 10 write units\n- Find a 1 KiB document by document ID and update 1 field with 1 index entry of 256 bytes. Consumes: 3 write units. Note: Updating an index entry in this situation consumes 2 write units -- one to delete and one to recreate the index entry.\n- Find a 1 KiB document by document ID and update nothing (no changes). Consumes: 1 write units (the minimum write costs)\n- Query all 1 KiB documents in a collection, which scans 1,000 documents, and insert a new 256 bytes field with no indexes on the collection: 1000 read units and 1000 writes units.\n\n### Deletes\n\n- Delete a 1 KiB document, which has 1 index on the collection. Consumes: 2 write units\n- Delete a 1 KiB document, which has no indexes on the collection. Consumes: 1 write unit\n\nIndex builds\n------------\n\nIndex builds charge for the index entries created or modified during the build\noperation. These costs are incurred anytime an index definition is added or\nremoved. The index entries are billed identically to writes incurring 1 write\nunit per 1KiB.\n\n- Create a new index for a collection containing 500 documents, index entries created are 1 KiB each. Consumes 500 write units.\n- Delete an existing index for a collection containing 500 documents, index entries deleted are 1KiB each. Consumes 500 write units."]]