MCPcopy Create free account
hub / github.com/documentdb/documentdb / GetDocumentsCountRunTime

Function GetDocumentsCountRunTime

pg_documentdb/src/commands/coll_stats.c:1093–1109  ·  view source on GitHub ↗

* GetDocumentsCountRunTime returns document count by counting the documents in the * given collection at runtime. It always returns accurate count. */

Source from the content-addressed store, hash-verified

1091 * given collection at runtime. It always returns accurate count.
1092 */
1093static int64
1094GetDocumentsCountRunTime(MongoCollection *collection)
1095{
1096 StringInfo cmdStr = makeStringInfo();
1097 appendStringInfo(cmdStr,
1098 "SELECT COUNT(*) FROM %s.documents_" UINT64_FORMAT,
1099 ApiDataSchemaName, collection->collectionId);
1100 bool isNull = true;
1101 bool readOnly = true;
1102 Datum resultDatum = ExtensionExecuteQueryViaSPI(cmdStr->data, readOnly, SPI_OK_SELECT,
1103 &isNull);
1104 if (isNull)
1105 {
1106 return 0;
1107 }
1108 return DatumGetInt64(resultDatum);
1109}
1110
1111
1112/*

Callers 1

MergeWorkerResultsFunction · 0.85

Calls 1

Tested by

no test coverage detected