Skip to content
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

Question: index on property (across all types) #1861

Open
justin2004 opened this issue Dec 12, 2024 · 2 comments
Open

Question: index on property (across all types) #1861

justin2004 opened this issue Dec 12, 2024 · 2 comments
Assignees
Labels
performance question Further information is requested
Milestone

Comments

@justin2004
Copy link

Once the database starts getting populated with nodes and edges gremlin queries like this start executing slowly:

g.V().has("uri","uri://a10").as("s").V().has("uri","uri://a10/description").as("o").addE("described_by").from("s").to("o").next()

However, if I do this:

create index on `typeHere` (`uri`) unique
create index on `anotherTypeHere` (`uri`) unique

Then run queries like this then they execute quickly:

g.V().hasLabel('typeHere').has("uri","uri://a10").as("s").V().hasLabel('anotherTypeHere').has("uri","uri://a10/description").as("o").addE("described_by").from("s").to("o").next()

The trouble is, we don't always know what kind/type/label of vertex we are looking for. Mostly we only know its uri property value and we want to get the vertex with that particular uri value.

Is it possible to create an index on the property uri across all types so that gremlin queries like this:

g.V().has("uri","uri://a10").as("s").V().has("uri","uri://a10/description").as("o").addE("described_by").from("s").to("o").next()

always use an index for looking up the uri value?

In other words, is it possible to create a single index on a property (that all nodes (of all types) will have) that gremlin queries will use?

ArcadeDB Version:

v.23.10.1-SNAPSHOT
Runs on Linux 5.15.0-125-generic - OpenJDK 64-Bit Server VM 11.0.24 (Temurin-11.0.24+8)

@lvca
Copy link
Contributor

lvca commented Dec 12, 2024

Yes, create a base vertex type, like 'Node' with the uri indexed property and then let all the vertex types extend from that base type.

@lvca
Copy link
Contributor

lvca commented Dec 12, 2024

If you have tons of types can actually slow down things. I suggest also to create vertex type with 1 bucket only if you have many vertex types. This will speed up such lookup.

@lvca lvca added question Further information is requested performance labels Dec 12, 2024
@lvca lvca self-assigned this Dec 12, 2024
@lvca lvca added this to the 24.12.1 milestone Dec 12, 2024
@lvca lvca modified the milestones: 24.12.1, 25.1.1 Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants