Composite index - ZigZag Merge

114 views
Skip to first unread message

Rajesh Gupta

unread,
Mar 6, 2017, 7:31:31 AM3/6/17
to google-a...@googlegroups.com
Hi, 
I have the following ofy class

class Job {
  @Id
   Long id;
  @Index
  String tenantId;
  @Index
  long partyOrgId;
  @Index
  long seqId
}

ofy.query.filter("tenantId", tenantId).filter("partyOrgId", partyOrgId).sort("-seqId").first().now();

The above query throws an composite needed index exception error

<datastore-index kind="Job" ancestor="false" source="manual">
        <property name="partyOrgId" direction="asc"/>
        <property name="tenantId" direction="asc"/>
        <property name="seqId" direction="desc"/>
</datastore-index>

I was thinking, that the query should work with the help of the zigzag merge join without the need for the composite index.

Regards,
Rajesh
Accounting/Inventory/Orders/Sales/Purchase on Google Cloud Platform and Mobile

Jordan (Cloud Platform Support)

unread,
Mar 7, 2017, 2:07:22 PM3/7/17
to Google App Engine
As Google Groups is meant for general product discussions, this type of technical question is best suited for Stack Overflow

As noted before on Stack Overflow, you need to make sure you have both ("partyOrgId", "seqId" direction="desc") and ("tenantId", "seqId" direction="desc") individual indexes already created for the zigzag merge join to work. 

You can read the Advanced Search documentation to find out more information about what is required for zigzag merge join. Objectify also has their own documentation explaining how zigzag works
Reply all
Reply to author
Forward
0 new messages