There are plenty more variables to consider that could make a huge difference in performance. If the table is large (say 20 million records) and the selection size is above a certain size (roughly 15,000 records), DISTINCT VALUES is very slow for b-tree indexed fields. I'm seeing times over 10 seconds in single user mode. 4D has to load a lot of index pages. Does not seem to be a problem for cluster b-tree indexed fields.
John DeSoi, Ph.D. > On Oct 12, 2017, at 3:37 PM, Alan Tilson via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > But the longint field has unique values so I ran the whole test with it, > and found: > 34 ticks for the DV approach > 8 ticks for the sorting approach > 23 ticks again for the Min/Max approach > so the sorting approach seems better for fields that are unique or have > mostly distinct values. > > Also, I do have a Cluster B-tree index on the date field... > > I should stop now... ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************