I had around 24 million of docs generated in bucket to perform some stress test. So before testing I just want to confirm if the doc id (meta(t).id) is generated sequentially or not. Is there any such NQL query to find out that one.
META().id is the document key as it was inserted - it isn’t generated, it is user supplied. There is no serial identification of documents within the server - document identification is entirely down to what the user supplies as the key (and/or document content).
So you’d have to examine how the document keys were generated to identify them.
Typically a scheme including a key prefix would be used, for example "test_"||uuid() would generate unique keys all with the prefix “test_” for easy later identification. Or alternatively a field is sometimes added to the documents to group them instead.
If say uuid() alone was used to generate the document keys, then there is no way to distinguish them from others that also used uuid() for their keys.
Actually I had used below pillowfight command to generate 24 million records . As per pillowfight documentation it should generate doc id sequentially i:e. a0000000000000000000 to a0000000000024000000. I just want to reconfirm this part so that we will perform some tests accordingly. Could you please help me how we can query to confirm this part.
This would be very slow but would identify any gaps in the range you’re looking at:
SELECT k
FROM ARRAY_RANGE(0,24000000) n
LET p = "00000000"||TO_STRING(n)
,k = 'a00000000000'||SUBSTR(p,LENGTH(p)-8)
WHERE NOT EXISTS (SELECT true FROM default USE KEYS[k])
;
If all you need to know is if there are gaps, not the missing keys themselves, then a COUNT would be more efficient.