[SERVER-2397] Query to return every Nth value from the collection Created: 21/Jan/11 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jason Thomas | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Query Optimization
|
||||
| Participants: | |||||
| Description |
|
Various relational databases have all implemented their own methods to return every nth value from the database. It doesn't seem like MongoDB has the capability at all. My use case it storing a year's worth of data with second granularity. I want to graph an overview of the year and allow a drill down to smaller time granulations. Thus my year query would request every 10000th value (for example) while an hours worth would return every value. Both of these queries would return roughly the same amount of data so be worked with in the application. I realize you'd incur a lot of file seek times if you had to grab data spanning multiple files but I still need the capability. |
| Comments |
| Comment by Mathias Stearn [ 06/Oct/11 ] |
|
Some discussion of workarounds at http://groups.google.com/group/mongodb-user/browse_thread/thread/3d730dd50bffea1c |
| Comment by Jason Thomas [ 24/Jan/11 ] |
|
It varies by DB because SQL doesn't define a good way to do this. In Oracle: In MySQL: In Sqlite: |
| Comment by Eliot Horowitz (Inactive) [ 23/Jan/11 ] |
|
How would you do this in sql? |