I would expect: Distinct Values grabs the unique value(s) stored in the index, which is likely in memory already.
Regardless of an index, Selection to Array has to copy all the data from the field(s) specified, for the selection, into an array. This means loading the data (even if only the requested fields) from DISK. <- here is a big slow down. Probably you could speed up selection to array by using an SSD, given the time you specified, an SSD would likely decrease the time Selection to Array took from 230 seconds to 2.3 seconds, and maybe even down to 0.23 seconds. (SSD access time is given in nanoseconds, spinning rust in milliseconds. That is a factor of roughly 1000) On Fri, 12 Aug 2016 11:05:54 -0500, Richard Wright wrote: > I have a table of 4.7 million records and an indexed LongInt primary > key field. If I do Distinct Values on the field it takes < 1 second > but Selection to Array takes 230 seconds, as if it’s not using the > index at all. I thought for sure that Selection to Array was supposed > to use the index. I can sort the table in < 1 sec so, if I have a > sorted index, why can’t it just dump that into an array? > > Distinct Values works on the selection, not the entire table, and the > speed difference holds up even when I use a partial selection of > records. So if Distinct Values know how to grab only that part of the > index represented by the selection, why doesn’t Selection to Array? > > ------------------------------------------------ > Richard Wright > DataDomain > [email protected] > ------------------------------------------------ > > ********************************************************************** > 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:[email protected] > ********************************************************************** ********************************************************************** 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:[email protected] **********************************************************************

