2 / 2
Nov 2024

I have just benchmarked locally the time series collections.
I have created two different collections and inserted 100K rows to each of them.

Following are the performances and disk usages taken from the debugger (TS means time series):

/** * Write performance, TS VS non TS collection: * @example insert 100K rows (TS collection: 12.347s) | (non TS collection: 10.52) * @example storage size of 100K rows (TS collection 292/79mb) | (non TS collection: 292/127 mb) */

The 292 is the size of the data and 79 and 129 respectively are the actual disk usages for each collection, so you can see that inserting is slower in TS collections, however, smaller disk usage.

Inserts were tested in bulk.

/** * Read performance, TS VS non TS collection: * @example read 20K rows one by one (TS: 19s) | (non TS: 19.649) * @example read 100K rows by bulk (TS: 9.859s) | (non TS: 8.116s) */

As you can see, EVEN FOR READ the non TS collections are faster than the optimized TS collections.

Note: If you project the returned fields and take only one field for example, the time will be around 1.5s to fetch the data in both of them. Where the TS collections are just faster than the regular ones in about 50ms.

So from this test, it worth nothing to utilize time series collections.
It adds HUGE overhead as time series doesn’t get supported by the change stream, plus, there is NO ABILITY TO UPDATE!!! a time series record - which is almost impossible to work like that, and more and more limitations that can be found in the official mongodb docs.

I am aware that the purpose of time series collection is to separate the data to buckets and in this test I used a single bucket for all. However, regular collections can also create index on a time field of a choice and it should act the same as the bucket mechanism.

MongoDB team, is it about to change?
Developer community, you have anything to share? What do you think about this? Is anyone uses time series collection for production in a real big data workload?

Coincidentally, this just came out: