-
-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Copy link
Milestone
Description
Hello,
following this comment : #3399 (comment)
So i got my query that takes 9 seconds and returns NOTHING
PROFILE WITH
500 AS nb_persons,
500 AS min_pings,
500 AS max_pings,
datetime('2024-01-01T00:00:00') AS start_date,
7 * 24 * 60 * 60 AS time_window_sec,
48.80 AS lat_min, 48.90 AS lat_max,
2.25 AS lon_min, 2.40 AS lon_max
UNWIND range(1, nb_persons) AS i
WITH i, min_pings, max_pings, start_date, time_window_sec, lat_min, lat_max, lon_min, lon_max,
rand() AS r_dev_distro
WITH i, min_pings, max_pings, start_date, time_window_sec, lat_min, lat_max, lon_min, lon_max,
CASE
WHEN r_dev_distro < 0.90 THEN 1
WHEN r_dev_distro < 0.97 THEN 2
ELSE 3
END AS num_devices
CREATE (p:Person {
name: "Suspect_" + tostring(rand()),
dataset_batch: start_date
})
WITH p, num_devices, min_pings, max_pings, start_date, time_window_sec, lat_min, lat_max, lon_min, lon_max
UNWIND range(1, num_devices) AS d_idx
CREATE (d:Device {
imei: "IMEI_" + split(p.name, '_')[1] + "_" + d_idx,
num: "06" + toInteger(rand() * 89999999 + 10000000)
})
CREATE (p)-[:OWNS]->(d)
WITH d, min_pings, max_pings, start_date, time_window_sec, lat_min, lat_max, lon_min, lon_max,
toInteger(rand() * (max_pings - min_pings) + min_pings) AS nb_pings_target
UNWIND range(1, nb_pings_target) AS p_idx
WITH d, start_date, time_window_sec, lat_min, lat_max, lon_min, lon_max,
rand() AS r_lat, rand() AS r_lon, rand() AS r_time
CREATE (ping:Ping {
location: point(
r_lat * (lat_max - lat_min) + lat_min,
r_lon * (lon_max - lon_min) + lon_min
),
time: start_date + duration({seconds: toInteger(r_time * time_window_sec)})
})
CREATE (d)-[:GENERATED]->(ping)Adding profile at the very top,
PROFILE WITH
500 AS nb_persons,
.........
.........
.........Now ... returns 25 entries with this as first and second entry :
"records": [
{
"profile": "OpenCypher Query Profile\n========================\n\nExecution Time: 7040,277 ms\nRows Returned: 285000\n\nExecution Plan (Traditional):\nStep-by-step interpretation\n"
},
{
"d": {
"@rid": "#4:563",
"@type": "Device",
"@cat": "v",
"imei": "IMEI_0.593242215365322_1",
"num": "0659922481",
"@out": 500,
"@in": 1
},
"start_date": "2024-01-01T00:00Z",
"time_window_sec": 604800,
"lat_min": 48.8,
"lat_max": 48.9,
"lon_min": 2.25,
"lon_max": 2.4,
"r_lat": 0.4844906791934076,
"r_lon": 0.4509664945207912,
"r_time": 0.7222826141564742,
"ping": {
"@rid": "#8:862404",
"@type": "Ping",
"@cat": "v",
"location": "Pt(x=48.84844906791934,y=2.3176449741781187)",
"time": "2024-01-06T01:20:36Z",
"@out": 0,
"@in": 1
}
},Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels