I think you've just create a manual index (it's up to you to populate it). You need an automatic index, so let's keep it strict to the SQL syntax:
CREATE INDEX demo.primaryid ON demo(primaryid) UNIQUE_HASH_INDEX Best Regards, Luca Garulli Founder & CEO OrientDB LTD <http://orientdb.com/> On 19 June 2016 at 16:35, Fabio Rinnone <fabio.rinno...@gmail.com> wrote: > I've tried following commands from console: > > > DROP INDEX demo.primary_demo > Index removed successfully > > > CREATE INDEX demo.primaryid UNIQUE_HASH_INDEX > Created index successfully with 314858 entries in 15.230000 sec(s). > > but > > EXPLAIN SELECT FROM cluster:demo15q4 WHERE primaryid = 117596311 > > produces the same result. > > But I noticed now that if I try to execute the query not into cluster > but into class as following: > > EXPLAIN SELECT FROM demo WHERE primaryid = 117596311 > > the query obtains result in 0.006000 sec(s): it is very best time! But > why? Is it not possible to query a cluster using an indexed property? > > I will load many cluster and I'm not sure if in the future the query can > maintain these optimal results, if I query is executed into entire class > rather than a specified cluster. > > Il 19/06/2016 16:16, Luca Garulli ha scritto: > > Ok, so no index has been used. Could you please drop and recreate it? If > > you are using 'primaryid' to just lookups and never ranges (ex: SELECT > > FROM cluster:demo15q4 WHERE primaryid > 117596311) I suggest you to use > > the HASH_INDEX because it's faster. > > > > > > > > Best Regards, > > > > Luca Garulli > > Founder & CEO > > OrientDB LTD <http://orientdb.com/> > > -- > Fabio Rinnone > Skype: fabiorinnone > Web: http://www.fabiorinnone.eu > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to orient-database+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.