[SERVER-60649] Show clustered index on timeseries collection as an index on time to users Created: 13/Oct/21  Updated: 09/Jun/22  Resolved: 09/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Fausto Leyva (Inactive)
Resolution: Won't Do Votes: 0
Labels: execution-product-sync, time-series
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-58150 Time-series collections should someho... Closed
Sprint: Execution Team 2022-05-16, Execution Team 2022-05-30, Execution Team 2022-06-13
Participants:

 Description   

Time-series collections show no indexes by default. After SERVER-59798 we will show a clustered index to users on any clustered collections, but not on the time-series buckets collection.

We should take this a step further and have listIndexes show the clustered index on _id for the buckets collection, and when listIndexes is run on a time-series collection transform that the spec by showing an index on time.



 Comments   
Comment by Fausto Leyva (Inactive) [ 09/Jun/22 ]

The original goal of this ticket was to reduce user confusion and although the change would increase clarity when running listIndexes on a time-series collection, michael.gargiulo@mongodb.com is concerned we would encounter some confusion when differentiating between the clustered index and a secondary index on time (required to avoid index key name collisions when passing an index as a hint). Seeing as we rely heavily on hints for sorting, we are closing the ticket as we no longer see this ticket being as beneficial as originally intended.

Comment by David Percy [ 01/Apr/22 ]

We should consider how listIndexes and hints interact. On a normal collection you can take any 'key' returned by listIndexes and pass it in as a hint. If two indexes have the same key, you get an error: "Hint matched multiple indexes, must hint by index name."

If we made time-series collections report a fake index on {time: 1}, would hint({time: 1}) do a clustered collscan? (You can already hint a clustered collscan with {$natural: 1}.) If there's also a secondary index on {time: 1}, would hint({time: 1}) be ambiguous and raise that error?

Comment by Daniel Gomez Ferro [ 21/Jan/22 ]

 From SERVER-58150 :

One option we could consider:

  • Report a fake index on {time: 1} in listIndexes with some flag indicating that it is built-in and the primary index, like "builtIn: true"
  • Secondary indexes on {time: 1} will not have this "builtIn" flag. In this way, users can differentiate between the built-in index and any secondary indexes they build.
Generated at Thu Feb 08 05:50:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.