Hello,
I like to make a JOIN with two kinds of documents within same bucket.
The key is the event.story which contains the id of the story.
Story
{
"_id": “9BF5BDC7-C195-4135-8DB8-6E98E586D6ED”,
“editor”: “7c1955e9-d044-4f17-bfb3-e319686a4a83”,
“model_type”: “Story”,
“title”: “Bach”
},
Event
{
"_id": “00000026-4644-42ac-854d-40e3762959ce”,
“epochDate”: “2015-12-10T13:16:33.449Z”,
“model_type”: “Event”,
“story”: “9BF5BDC7-C195-4135-8DB8-6E98E586D6ED”,
“type”: 1
},
I use WHERE to specify an editor and type.
Query
SELECT event._id AS eventId, event.epochDate AS eventDate, event.type AS eventType, story._id AS storyId, story.editor AS editor, story.type AS storyType
FROM storyplayer-api
event INNER JOIN storyplayer-api
story ON KEYS event.story
WHERE (story.editor = “ECC82E13-4050-4B27-A639-76293F5F27C8” and (event.type = 1 or event.type = 2))
I create 3 INDEX but only event_type is use.
CREATE INDEX event_story ON storyplayer-api
(story) ;
CREATE INDEX event_editor ON storyplayer-api
(editor) ;
CREATE INDEX event_type ON storyplayer-api
(type) ;
I am getting output in sever minutes like 7 or 8 minutes.
I think i don’t use Index in the good way…
How can i improve the performance?
Thanks
Franck