From 3a284c99474598868eaf59bab107cab6edbd1060 Mon Sep 17 00:00:00 2001
From: Bruno Nocera Zanette <bnzanette@inf.ufpr.br>
Date: Mon, 21 Sep 2015 11:59:53 -0300
Subject: [PATCH] Fix bug: Wrong COUNT query for OrientDB

Query was taking too long to execute.
---
 lib/orient_db/methods/edge_methods.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/orient_db/methods/edge_methods.rb b/lib/orient_db/methods/edge_methods.rb
index dd207325e..9d00cf9a3 100644
--- a/lib/orient_db/methods/edge_methods.rb
+++ b/lib/orient_db/methods/edge_methods.rb
@@ -5,7 +5,7 @@ module OrientDb
       ##
       # Count the number of edges existent
       def get_in_edges_count(edge_class, id)
-        result = connection.query "SELECT COUNT(@rid) FROM #{edge_class} WHERE in = #{id}"
+        result = connection.query "SELECT IN('#{edge_class}').size() AS COUNT FROM Object WHERE @rid = #{id} LIMIT 1"
         result.first["COUNT"].to_i
       end
 
-- 
GitLab