Skip to content

Very slow with filter or order querying #4810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JimWen opened this issue Feb 19, 2020 · 2 comments
Closed

Very slow with filter or order querying #4810

JimWen opened this issue Feb 19, 2020 · 2 comments
Labels
investigate Requires further investigation status/accepted We accept to investigate/work on it. status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it

Comments

@JimWen
Copy link

JimWen commented Feb 19, 2020

What version of Dgraph are you using?

  • Dgraph version : v1.2.1
  • Dgraph SHA-256 : 3f18ff84570b2944f4d75f6f508d55d902715c7ca2310799cc2991064eb046f8
  • Commit SHA-1 : ddcda92
  • Commit timestamp : 2020-02-06 15:31:05 -0800
  • Branch : HEAD
  • Go version : go1.13.5

Have you tried reproducing the issue with the latest release?

Not yet with 2.x version, but nothing fix notice founded from the releases note

What is the hardware spec (RAM, OS)?

128G mem & 1.8T SSD

Linux version 3.10.0-1062.9.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Fri Dec 6 15:49:49 UTC 2019

Steps to reproduce the issue (command/config used to run Dgraph).

The data is User behavior in app like click/chat/signin/signup etc. And so the schme is like

type User{

gid_user
name
}

type Action{
type
t
net
from
to
with
}

gid_user: int @index(int) .
name: string @index(hash) .

type:string @index(hash) .
t:dateTime @index(hour) .
net:string @index(hash) .
from:uid @reverse .
to:uid @reverse .
with:[uid] @count @reverse .

and the graph is like
user1 - from- action1-to-user2
user1 - from- action2-to-user3
user1 - from- action3-to-user4

now we have user 5 million nodes and 2 billion action nodes, i want to query user's action list like followings

{
	res(func: eq(gid_user, 52953149)) {
		src
		~from {
			type
			t
			to {
				expand(_all_)
			}
			with {
				expand(_all_)
			}
		}
	}
}

then i want to query order by time like followings

{
	res(func: eq(gid_user, 52953149)) {
		src
		~from (orderdesc:t) {
			type
			t
			to {
				expand(_all_)
			}
			with {
				expand(_all_)
			}
		}
	}
}

then i want to query one type action like followings

{
	res(func: eq(gid_user, 52953149)) {
		src
		~from @filter(eq(type, "signin")) {
			type
			t
			to {
				expand(_all_)
			}
			with {
				expand(_all_)
			}
		}
	}
}

then i want to query user's action begin from a time like followings

{
	res(func: eq(gid_user, 52953149)) {
		src
		~from @filter(ge(t, "2020-02-02T21:24:24+08:00"))  {
			type
			t
			to {
				expand(_all_)
			}
			with {
				expand(_all_)
			}
		}
	}
}

Expected behaviour and actual result.

The problem is when i just query the whole action list of a user, it's about 5-20ms, but when i query with order or filter on one index, the time >500ms which is more then 100 times.

Why does this happen, the total action of a user is at most 2000, then with filter or order it shoud't be so slow. I guess when use filter or order, it just query the whole index kv to match what we want?

@MichelDiz MichelDiz added investigate Requires further investigation status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it labels Feb 19, 2020
@harshil-goel harshil-goel added the status/accepted We accept to investigate/work on it. label May 11, 2020
@harshil-goel
Copy link
Contributor

We are working on #2713, and it should be the same issue. Please track the progress in that thread.

@minhaj-shakeel
Copy link
Contributor

Github issues have been deprecated.
This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Requires further investigation status/accepted We accept to investigate/work on it. status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it
Development

No branches or pull requests

4 participants