Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
ma_code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sven-Ove Hänsel
ma_code
Commits
fb773e21
Commit
fb773e21
authored
8 months ago
by
julian
Browse files
Options
Downloads
Patches
Plain Diff
much larger improvement to two_hop query performance
parent
c4497536
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
queries/queries.sql
+14
-18
14 additions, 18 deletions
queries/queries.sql
with
14 additions
and
18 deletions
queries/queries.sql
+
14
−
18
View file @
fb773e21
...
...
@@ -88,23 +88,19 @@ PREPARE two_hop_old (INTEGER) AS
WHERE
vertex
<>
$
1
;
PREPARE
two_hop_new
(
INTEGER
)
AS
WITH
hop1
AS
(
SELECT
destination
vertex
FROM
edge
WITH
double_edge
AS
NOT
MATERIALIZED
(
SELECT
source
,
destination
FROM
edge
UNION
ALL
SELECT
destination
,
source
FROM
edge
),
hop1
AS
NOT
MATERIALIZED
(
SELECT
destination
AS
vertex
FROM
double_edge
WHERE
source
=
$
1
union
all
select
source
from
edge
where
destination
=
$
1
),
hop2
AS
(
SELECT
source
,
destination
FROM
edge
JOIN
hop1
ON
source
=
vertex
OR
destination
=
vertex
)
SELECT
DISTINCT
vertex
FROM
(
SELECT
source
AS
vertex
FROM
hop2
SELECT
vertex
FROM
hop1
UNION
ALL
SELECT
destination
FROM
hop2
)
WHERE
vertex
<>
$
1
;
SELECT
DISTINCT
destination
FROM
double_edge
JOIN
hop1
ON
vertex
=
source
WHERE
destination
<>
$
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment