Orientdb: How to query cluster's records count with SQL

Created on 14 Mar 2018  ·  7Comments  ·  Source: orientechnologies/orientdb

OrientDB Version: 2.2.15

Java Version: 1.8

OS: CentOS 7

I need query cluster's records count with SQL,use “selec count(*) from foo where @rid like '#10:%' ” is fine in little data. But in big data , will be very slow

Description

1.I have about 1,000,000 record In foo

  1. I use this sql
selec count(*) from foo where @rid like '#10:%' 

and I got this result

Query executed in 35.095 sec. Returned 1 record(s)

Any suggestions ?

question

Most helpful comment

You can do it as follows, but it only works with cluster names (not with cluster IDs)

select count(*) from cluster:[countries,countries_1]

Thanks

Luigi

All 7 comments

Hi @robben766

The right syntax is following:

SELECT count(*) FROM cluster:10

Thanks

Luigi

Thanks

I want to query multiple clusters. What should the syntax look like?

You can do it as follows, but it only works with cluster names (not with cluster IDs)

select count(*) from cluster:[countries,countries_1]

Thanks

Luigi

Thanks

@luigidellaquila Where is the document address of the the syntax? I didn't see the above syntax in the document.

Hi @yczhaoDevelop

You are right, this page https://orientdb.com/docs/2.2.x/SQL-Query.html only reports the cluster:clustername syntax, not the cluster:clusterId, I'm updating it now

Thanks

Luigi

Was this page helpful?
0 / 5 - 0 ratings