I have different results for space:len()
and space:count()
for a space with a vinyl engine. What do these methods return?
Scanning vinyl space and counting exact number may be very expensive, that's why :len()
function exists. It gives you fast but approximate result. If it doesn't work for you, use :count()
function instead. It does full scan and returns correct result.
For more info there is related issue on this topic and implementation commit says the following:
index.len returns the total number of rows stored in the index.
It is the sum of memory.rows and disk.rows as reported by
index.info. Note, it may be greater than the number of tuples
stored in the space, because it includes DELETE and UPDATE
statements.