SELECT inV().name as name, COUNT(in) AS weight
FROM UserUsedTag
WHERE timestamp < date('2015-04-24 09:40:00')
GROUP BY in
ORDER BY weight DESC
name | weight |
---|---|
baseball | 6117 |
soccer | 5003 |
METADATA | PROPERTIES | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@version | resultSize | fullySortedByIndex | documentAnalyzedCompatibleClass | recordReads | fetchingFromTargetElapsed | indexIsUsedInOrderBy | compositeIndexUsed | current | documentReads | projectionElapsed | limit | orderByElapsed | evaluated | groupByElapsed | user | elapsed | resultType | involvedIndexes |
0 | 2 | false | 11120 | 11120 | 313 | false | 1 | #14:11120 | 11120 | 6 | -1 | 0 | 11120 | 0 | #5:0 | 353.77362 | collection | ["UserUsedTag.timestamp"] |
--
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Understood about X2 - - > Y2. However I wanted to confirm if the bottleneck was due to the system navigating the edge 6000 times to retrieve the "name" field from the same vertex.
I'm afraid hooks are out of the question since my next query is to determine, for a specific user, which tags he used the most. I cannot start creating a table for each user for each day month year etc. Especially since I mean past [x] months from this instant, not a calendar month.
Can you confirm if my query is slow due to the repeated re-fetching of the "name" field of my Tag vertex?
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/rLBqzmENmcU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
SELECT in.name AS name, COUNT(in.name) AS weight
FROM UserUsedTag
WHERE "john.doe" IN out.username
AND timestamp < date()
GROUP BY in.name
ORDER BY weight DESC
SELECT public.tag.name, selection.weight FROM (
SELECT tag_id, COUNT(tag_id) AS weight FROM public.user_used_tag_link
WHERE timestamp < CURRENT_TIMESTAMP
AND user_id = 1
GROUP BY tag_id
ORDER BY weight DESC
) AS selection
JOIN public.tag ON selection.tag_id = public.tag.id
ORDER BY selection.weight DESC;
Hi there,
OK -- I'm a bit surprised, in a way; this is a straightforward SELECT statement.I decided to run another experiment. My scenario: determine which tags are a given user's favourite.My query in OrientDB:
SELECT in.name AS name, COUNT(in.name) AS weight
FROM UserUsedTag
WHERE "john.doe" IN out.username
AND timestamp < date()
GROUP BY in.name
ORDER BY weight DESCQuery executed in 0.487 sec. Returned 2 record(s)soccer 5042baseball 4958
SELECT inV().name AS name, COUNT(*) AS weight FROM (
SELECT FROM (
SELECT expand(outE("UserUsedTag"))
FROM user
WHERE username = "john.doe"
) WHERE timestamp > date('2015-04-25 05:00:22')
AND timestamp < date('2015-04-25 05:01:10')
)
GROUP BY in
ORDER BY weight DESC
SELECT inV().name AS name, COUNT(*) AS weight FROM (
SELECT expand(outE("UserUsedTag"))
FROM user
WHERE username = "john.doe"
)
WHERE timestamp > date('2015-04-25 05:00:22')
AND timestamp < date('2015-04-25 05:01:10')
GROUP BY in
ORDER BY weight DESC
SELECT inV().name AS name, COUNT(*) AS weight FROM ( SELECT expand(outE("UserUsedTag")) FROM user WHERE username = "john.doe")
WHERE timestamp > date('2015-04-27 15:13:00')AND timestamp < date('2015-04-27 15:17:00')
GROUP BY inORDER BY weight DESC
METADATA | PROPERTIES | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@version | resultSize | current | recordReads | rangeQueryConvertedInBetween | limit | fetchingFromTargetElapsed | projectionElapsed | documentReads |
orderByElapsed | evaluated | groupByElapsed | user | elapsed | resultType |
---|
(UserUsedTag extends E, NOTUNIQUE index on UserUsedTag.timestamp)
Let me know if you can determine what causes my query to take almost half a second. Hopefully we uncover something I'm doing wrong -- the database is great beyond this particular issue.