Closed alexwillrock closed 6 years ago
+100500
We have sortedResultsUsingKeyPath:
, could we possibly have distinctedResultsUsingKeyPath:
?
PS: Without having looked it up, I'm not sure if 'distincted' is the correct past-participle for 'distinct' (English isn't my first language).
Sorted isn't used as a verb in the past tense but rather as an adjective: "the results are sorted".
So the equivalent naming for distinct would be distinctResultsUsingKeyPath:
: "the results are distinct".
But I think the current implementation doesn't support nested key paths, so they can only be applied to direct properties of an object, so we might not call it a "key path" either, simply just "property".
I think the objectstore part doesn't support nested keypaths, but that would be pretty easy to fix. The core distinct logic does support all the same things as sorting.
+1
Please implement it at last
Hi Any status? 220000 rows. Query are fast, but get distinct are very slow.
Any updates? This issue open at 2014; and seems the "Core" already finished the distinct API.
I need it so badly, pls implement it ;)
@FreudGit what's your meaning?? so, Is there any indirectly way to implement it ?
@0xdatou you can perform a distinct operation in memory by copying data out of a Realm: https://github.com/realm/realm-cocoa/issues/1103#issuecomment-125381124
This issue is tracking adding built-in support in Realm itself, with auto-updating Results
consistent with all our other querying capabilities.
The table I want to use distinct on has about 100.000 objects, also to be able to make sections in the table that displays the data. Post-query filtering/mapping to figure out the section count and titles is a hit on performance, because the user can filter the data using a search bar on the fly. Currently that means it'll need to re-map the sections and go over those 100.000 records with every keystroke.
Is there any other way to keep this performing well without the use of distinct? Or can we expect this feature soon?
@krummler you might want to checkout this pull request.
@qubblr Thanks, sounds great, but so far this hasn't been implemented/merged? Is there any alternative or temporary solution?
With Realm-Core 3.0+ the behavior seems well-determined enough so that this could be made available in Cocoa, just like in Realm-Java
@jpsim Will this be implemented in Cocoa version? :)
Fixed by #5467.
When will the next release be in which this is included?
» When will the next release be in which this is included? +1
hello, realm is super fast db but very necessary distinct query from database e.g. schedules = Schedules.objectsWhere("areas.id = '(idAreas)' distict")