Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement single-directional rel table storage (not including updates) #4688

Merged
merged 4 commits into from
Jan 11, 2025

Conversation

royi-luo
Copy link
Collaborator

@royi-luo royi-luo commented Jan 7, 2025

Description

Adds option for rel tables to only store data in the forward direction. Implemented parts include:

  • Update grammar for creating rel tables
    • For now this will be internal, we can discuss the grammar (and this feature as a whole) once everything is implemented
    • For now grammar will look like this:
// We introduce `WITH` to specify storage options.
CREATE REL TABLE Follows (FROM User TO User, since DATE) WITH (storage_direction = 'fwd_only');
  • Update catalog to include storage direction for rel tables
  • RelBatchInsert only creates pipelines for the required directions
  • Partitioner only create partitions for the required directions
  • bwdRelData is optional in RelTable
  • Integrate into FTS (specifically the FTS index is now created with WITH (storage_direction = 'fwd_only')

Future TODOs

The following are still required to complete the feature:

  • Support inserts/updates/deletes (updates to local storage + commit)
  • Planner considers storage direction when planning extends
  • Correctly support rel table groups

Partially addresses #4320

Contributor agreement

@royi-luo royi-luo self-assigned this Jan 7, 2025
@royi-luo royi-luo force-pushed the royi/fwd-rel-table branch from 67e47e6 to 8967b7f Compare January 8, 2025 00:19
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 96.53179% with 6 lines in your changes missing coverage. Please review.

Project coverage is 86.18%. Comparing base (d5acb79) to head (8fc9faa).

Files with missing lines Patch % Lines
src/binder/bind/ddl/bound_create_table_info.cpp 33.33% 2 Missing ⚠️
.../catalog/catalog_entry/rel_table_catalog_entry.cpp 88.88% 2 Missing ⚠️
src/common/enums/rel_direction.cpp 89.47% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4688   +/-   ##
=======================================
  Coverage   86.17%   86.18%           
=======================================
  Files        1375     1375           
  Lines       58491    58565   +74     
  Branches     7221     7239   +18     
=======================================
+ Hits        50407    50474   +67     
- Misses       7920     7927    +7     
  Partials      164      164           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@royi-luo
Copy link
Collaborator Author

royi-luo commented Jan 8, 2025

Quick sanity check for FTS index size:

Query: CALL CREATE_FTS_INDEX('doc', 'docIdx', ['content', 'author', 'name']) on fts-small dataset

data.kz size (master) data.kz size (new)
188KB 152KB

Copy link

github-actions bot commented Jan 8, 2025

Benchmark Result

Master commit hash: decc6d5823880dbb9ae7194d12d608decb7ec5a8
Branch commit hash: 575bed8b4a0c5e235335468c4f24f081b4555b48

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 647.12 651.46 -4.34 (-0.67%)
aggregation q28 12033.65 11887.29 146.36 (1.23%)
copy node-Comment 70348.84 72293.52 -1944.68 (-2.69%)
copy node-Forum 5420.39 5758.48 -338.09 (-5.87%)
copy node-Organisation 1214.05 1271.40 -57.35 (-4.51%)
copy node-Person 2209.75 2149.71 60.04 (2.79%)
copy node-Place 1192.01 1223.39 -31.38 (-2.57%)
copy node-Post 31422.00 29707.78 1714.22 (5.77%)
copy node-Tag 1261.69 1227.43 34.26 (2.79%)
copy node-Tagclass 1148.19 1165.80 -17.61 (-1.51%)
copy rel-comment-hasCreator 54703.80 56093.79 -1389.99 (-2.48%)
copy rel-comment-hasTag 89466.63 88119.41 1347.22 (1.53%)
copy rel-comment-isLocatedIn 70993.88 70385.49 608.39 (0.86%)
copy rel-containerOf 14978.59 15190.74 -212.15 (-1.40%)
copy rel-forum-hasTag 3999.30 4062.47 -63.17 (-1.55%)
copy rel-hasInterest 3114.06 3143.42 -29.36 (-0.93%)
copy rel-hasMember 118026.25 122287.14 -4260.89 (-3.48%)
copy rel-hasModerator 1267.23 1328.33 -61.10 (-4.60%)
copy rel-hasType 250.65 249.79 0.86 (0.34%)
copy rel-isPartOf 243.93 269.45 -25.52 (-9.47%)
copy rel-isSubclassOf 276.20 291.98 -15.78 (-5.40%)
copy rel-knows 13570.02 13403.27 166.75 (1.24%)
copy rel-likes-comment 173048.42 171621.25 1427.17 (0.83%)
copy rel-likes-post 69710.67 69556.08 154.59 (0.22%)
copy rel-organisation-isLocatedIn 289.05 280.09 8.96 (3.20%)
copy rel-person-isLocatedIn 484.18 445.01 39.17 (8.80%)
copy rel-post-hasCreator 15367.76 15102.05 265.71 (1.76%)
copy rel-post-hasTag 23617.24 24381.98 -764.74 (-3.14%)
copy rel-post-isLocatedIn 17730.98 18679.83 -948.85 (-5.08%)
copy rel-replyOf-comment 50534.42 49410.49 1123.93 (2.27%)
copy rel-replyOf-post 38626.51 39202.83 -576.32 (-1.47%)
copy rel-studyAt 800.72 849.33 -48.61 (-5.72%)
copy rel-workAt 1574.98 1522.89 52.09 (3.42%)
filter q14 128.90 127.29 1.62 (1.27%)
filter q15 134.12 133.73 0.40 (0.30%)
filter q16 312.03 310.34 1.69 (0.54%)
filter q17 454.80 454.80 0.01 (0.00%)
filter q18 1954.32 1966.81 -12.49 (-0.64%)
filter zonemap-node 90.94 89.62 1.32 (1.47%)
filter zonemap-node-lhs-cast 91.73 92.20 -0.48 (-0.52%)
filter zonemap-node-null 87.15 87.42 -0.27 (-0.30%)
filter zonemap-rel 5954.31 5727.51 226.81 (3.96%)
fixed_size_expr_evaluator q07 575.21 574.87 0.34 (0.06%)
fixed_size_expr_evaluator q08 803.76 804.41 -0.65 (-0.08%)
fixed_size_expr_evaluator q09 802.64 805.98 -3.34 (-0.41%)
fixed_size_expr_evaluator q10 241.18 239.68 1.50 (0.62%)
fixed_size_expr_evaluator q11 232.44 234.45 -2.01 (-0.86%)
fixed_size_expr_evaluator q12 231.29 227.59 3.70 (1.63%)
fixed_size_expr_evaluator q13 1470.64 1476.13 -5.49 (-0.37%)
fixed_size_seq_scan q23 114.67 119.40 -4.73 (-3.96%)
join q29 605.65 590.23 15.43 (2.61%)
join q30 9988.17 10180.83 -192.66 (-1.89%)
join q31 5.94 5.26 0.68 (12.99%)
join SelectiveTwoHopJoin 53.28 58.52 -5.24 (-8.96%)
ldbc_snb_ic q35 2678.52 2572.14 106.38 (4.14%)
ldbc_snb_ic q36 451.19 487.71 -36.51 (-7.49%)
ldbc_snb_is q32 5.24 3.45 1.79 (51.72%)
ldbc_snb_is q33 11.67 12.77 -1.10 (-8.65%)
ldbc_snb_is q34 1.26 1.24 0.03 (2.05%)
multi-rel multi-rel-large-scan 1363.28 1336.41 26.87 (2.01%)
multi-rel multi-rel-lookup 20.87 15.10 5.77 (38.20%)
multi-rel multi-rel-small-scan 93.33 83.67 9.66 (11.54%)
order_by q25 132.63 133.12 -0.49 (-0.37%)
order_by q26 448.22 457.26 -9.04 (-1.98%)
order_by q27 1498.78 1478.76 20.02 (1.35%)
recursive_join recursive-join-bidirection 309.81 297.17 12.64 (4.25%)
recursive_join recursive-join-dense 7413.29 7387.40 25.89 (0.35%)
recursive_join recursive-join-path 23711.20 23803.49 -92.29 (-0.39%)
recursive_join recursive-join-sparse 1069.37 1059.66 9.71 (0.92%)
recursive_join recursive-join-trail 7421.79 7350.57 71.22 (0.97%)
scan_after_filter q01 175.67 175.47 0.21 (0.12%)
scan_after_filter q02 158.89 158.15 0.73 (0.46%)
shortest_path_ldbc100 q37 90.22 101.08 -10.85 (-10.74%)
shortest_path_ldbc100 q38 359.92 371.39 -11.46 (-3.09%)
shortest_path_ldbc100 q39 64.98 59.72 5.26 (8.81%)
shortest_path_ldbc100 q40 446.54 367.64 78.90 (21.46%)
var_size_expr_evaluator q03 2101.02 2068.03 32.99 (1.60%)
var_size_expr_evaluator q04 2208.20 2241.98 -33.78 (-1.51%)
var_size_expr_evaluator q05 2702.74 2619.72 83.02 (3.17%)
var_size_expr_evaluator q06 1377.06 1318.61 58.44 (4.43%)
var_size_seq_scan q19 1479.54 1444.45 35.09 (2.43%)
var_size_seq_scan q20 2771.46 2687.44 84.03 (3.13%)
var_size_seq_scan q21 2332.82 2301.21 31.61 (1.37%)
var_size_seq_scan q22 131.33 127.52 3.81 (2.98%)

@@ -1,6 +1,7 @@
#include "binder/binder.h"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the storage direction to table info for now but not sure this is the best place since table info has one row per rel table property. I don't think there is an existing table function that works better though so it would probably be best to either have it here or have a new table function for storage direction

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine for now.

Copy link

github-actions bot commented Jan 8, 2025

Benchmark Result

Master commit hash: decc6d5823880dbb9ae7194d12d608decb7ec5a8
Branch commit hash: 28efcc73d13270f6bfae04a3d9897b0414901f39

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 660.35 643.95 16.39 (2.55%)
aggregation q28 11110.27 11660.75 -550.48 (-4.72%)
filter q14 138.82 129.08 9.74 (7.54%)
filter q15 142.55 125.65 16.90 (13.45%)
filter q16 319.24 309.40 9.84 (3.18%)
filter q17 457.79 446.79 10.99 (2.46%)
filter q18 1984.65 1934.79 49.86 (2.58%)
filter zonemap-node 98.92 89.14 9.78 (10.97%)
filter zonemap-node-lhs-cast 97.42 89.31 8.11 (9.08%)
filter zonemap-node-null 94.28 85.19 9.08 (10.66%)
filter zonemap-rel 5855.61 5756.87 98.74 (1.72%)
fixed_size_expr_evaluator q07 586.97 576.03 10.94 (1.90%)
fixed_size_expr_evaluator q08 818.49 803.63 14.86 (1.85%)
fixed_size_expr_evaluator q09 818.06 807.16 10.90 (1.35%)
fixed_size_expr_evaluator q10 257.90 239.15 18.75 (7.84%)
fixed_size_expr_evaluator q11 247.81 233.61 14.20 (6.08%)
fixed_size_expr_evaluator q12 242.71 226.41 16.31 (7.20%)
fixed_size_expr_evaluator q13 1460.38 1459.02 1.36 (0.09%)
fixed_size_seq_scan q23 131.75 108.29 23.46 (21.66%)
join q29 593.45 617.79 -24.34 (-3.94%)
join q30 9830.46 10120.48 -290.02 (-2.87%)
join q31 5.61 7.32 -1.70 (-23.24%)
join SelectiveTwoHopJoin 57.66 52.58 5.08 (9.66%)
ldbc_snb_ic q35 2599.73 2506.95 92.78 (3.70%)
ldbc_snb_ic q36 443.88 469.19 -25.31 (-5.39%)
ldbc_snb_is q32 6.93 3.87 3.06 (79.16%)
ldbc_snb_is q33 12.81 13.72 -0.92 (-6.69%)
ldbc_snb_is q34 1.36 1.50 -0.15 (-9.68%)
multi-rel multi-rel-large-scan 1370.52 1302.00 68.52 (5.26%)
multi-rel multi-rel-lookup 28.24 24.38 3.86 (15.85%)
multi-rel multi-rel-small-scan 96.07 76.69 19.38 (25.27%)
order_by q25 144.05 129.16 14.89 (11.53%)
order_by q26 467.12 448.84 18.28 (4.07%)
order_by q27 1480.34 1456.60 23.74 (1.63%)
recursive_join recursive-join-bidirection 282.40 281.94 0.46 (0.16%)
recursive_join recursive-join-dense 7380.68 7322.47 58.21 (0.79%)
recursive_join recursive-join-path 23854.22 24035.02 -180.80 (-0.75%)
recursive_join recursive-join-sparse 1086.70 1056.00 30.70 (2.91%)
recursive_join recursive-join-trail 7374.13 7294.89 79.24 (1.09%)
scan_after_filter q01 182.13 170.53 11.61 (6.81%)
scan_after_filter q02 168.96 155.05 13.91 (8.97%)
shortest_path_ldbc100 q37 86.82 90.35 -3.52 (-3.90%)
shortest_path_ldbc100 q38 364.52 371.71 -7.19 (-1.93%)
shortest_path_ldbc100 q39 62.36 61.64 0.72 (1.17%)
shortest_path_ldbc100 q40 422.86 400.90 21.95 (5.48%)
var_size_expr_evaluator q03 2071.64 2059.42 12.22 (0.59%)
var_size_expr_evaluator q04 2328.58 2222.65 105.92 (4.77%)
var_size_expr_evaluator q05 2565.07 2606.73 -41.67 (-1.60%)
var_size_expr_evaluator q06 1332.76 1317.42 15.35 (1.16%)
var_size_seq_scan q19 1464.62 1444.53 20.09 (1.39%)
var_size_seq_scan q20 2703.40 2679.22 24.18 (0.90%)
var_size_seq_scan q21 2318.13 2317.01 1.12 (0.05%)
var_size_seq_scan q22 132.18 126.87 5.31 (4.19%)

@royi-luo royi-luo force-pushed the royi/fwd-rel-table branch from 7809e95 to 49d8257 Compare January 8, 2025 17:13
@royi-luo royi-luo marked this pull request as ready for review January 8, 2025 18:05
Copy link

github-actions bot commented Jan 8, 2025

Benchmark Result

Master commit hash: decc6d5823880dbb9ae7194d12d608decb7ec5a8
Branch commit hash: 980bd21e0de090182ef46d9e88d82dcba2ad50f9

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 646.87 643.95 2.92 (0.45%)
aggregation q28 11061.29 11660.75 -599.45 (-5.14%)
copy node-Comment 72640.78 68451.44 4189.34 (6.12%)
copy node-Forum 5460.87 5488.48 -27.61 (-0.50%)
copy node-Organisation 1209.59 1208.26 1.33 (0.11%)
copy node-Person 2211.66 2139.74 71.92 (3.36%)
copy node-Place 1183.66 1147.13 36.53 (3.18%)
copy node-Post 30342.14 30123.40 218.74 (0.73%)
copy node-Tag 1284.42 1226.60 57.82 (4.71%)
copy node-Tagclass 1146.10 1173.21 -27.11 (-2.31%)
copy rel-comment-hasCreator 55495.89 57910.42 -2414.53 (-4.17%)
copy rel-comment-hasTag 89450.44 90209.68 -759.24 (-0.84%)
copy rel-comment-isLocatedIn 68846.30 71367.13 -2520.83 (-3.53%)
copy rel-containerOf 13764.76 15333.46 -1568.70 (-10.23%)
copy rel-forum-hasTag 3982.16 4014.23 -32.07 (-0.80%)
copy rel-hasInterest 3117.40 3075.03 42.37 (1.38%)
copy rel-hasMember 123678.73 123809.85 -131.12 (-0.11%)
copy rel-hasModerator 1304.62 1345.72 -41.10 (-3.05%)
copy rel-hasType 245.96 284.08 -38.12 (-13.42%)
copy rel-isPartOf 220.47 325.02 -104.55 (-32.17%)
copy rel-isSubclassOf 275.38 271.51 3.87 (1.43%)
copy rel-knows 14228.55 13915.39 313.16 (2.25%)
copy rel-likes-comment 178844.18 181294.75 -2450.57 (-1.35%)
copy rel-likes-post 69223.62 67694.13 1529.49 (2.26%)
copy rel-organisation-isLocatedIn 252.29 244.20 8.09 (3.31%)
copy rel-person-isLocatedIn 472.62 513.90 -41.28 (-8.03%)
copy rel-post-hasCreator 15447.14 14630.62 816.52 (5.58%)
copy rel-post-hasTag 24395.89 22502.55 1893.34 (8.41%)
copy rel-post-isLocatedIn 18558.45 18303.12 255.33 (1.40%)
copy rel-replyOf-comment 48129.39 47388.20 741.19 (1.56%)
copy rel-replyOf-post 39486.65 37680.53 1806.12 (4.79%)
copy rel-studyAt 830.21 761.69 68.52 (9.00%)
copy rel-workAt 1621.27 1564.97 56.30 (3.60%)
filter q14 131.39 129.08 2.31 (1.79%)
filter q15 131.65 125.65 6.00 (4.78%)
filter q16 310.70 309.40 1.30 (0.42%)
filter q17 454.08 446.79 7.28 (1.63%)
filter q18 1942.96 1934.79 8.17 (0.42%)
filter zonemap-node 91.87 89.14 2.72 (3.05%)
filter zonemap-node-lhs-cast 91.15 89.31 1.84 (2.06%)
filter zonemap-node-null 87.41 85.19 2.22 (2.61%)
filter zonemap-rel 5746.71 5756.87 -10.16 (-0.18%)
fixed_size_expr_evaluator q07 590.72 576.03 14.69 (2.55%)
fixed_size_expr_evaluator q08 813.87 803.63 10.25 (1.28%)
fixed_size_expr_evaluator q09 818.92 807.16 11.77 (1.46%)
fixed_size_expr_evaluator q10 244.92 239.15 5.77 (2.41%)
fixed_size_expr_evaluator q11 237.62 233.61 4.01 (1.71%)
fixed_size_expr_evaluator q12 238.82 226.41 12.42 (5.49%)
fixed_size_expr_evaluator q13 1479.27 1459.02 20.26 (1.39%)
fixed_size_seq_scan q23 117.82 108.29 9.53 (8.80%)
join q29 628.75 617.79 10.96 (1.77%)
join q30 10681.70 10120.48 561.23 (5.55%)
join q31 5.73 7.32 -1.59 (-21.71%)
join SelectiveTwoHopJoin 53.52 52.58 0.93 (1.77%)
ldbc_snb_ic q35 2549.83 2506.95 42.89 (1.71%)
ldbc_snb_ic q36 453.36 469.19 -15.83 (-3.37%)
ldbc_snb_is q32 7.50 3.87 3.64 (94.04%)
ldbc_snb_is q33 13.21 13.72 -0.51 (-3.73%)
ldbc_snb_is q34 1.39 1.50 -0.11 (-7.52%)
multi-rel multi-rel-large-scan 1347.58 1302.00 45.59 (3.50%)
multi-rel multi-rel-lookup 33.26 24.38 8.88 (36.42%)
multi-rel multi-rel-small-scan 81.22 76.69 4.53 (5.91%)
order_by q25 136.38 129.16 7.22 (5.59%)
order_by q26 455.58 448.84 6.73 (1.50%)
order_by q27 1498.73 1456.60 42.13 (2.89%)
recursive_join recursive-join-bidirection 293.95 281.94 12.01 (4.26%)
recursive_join recursive-join-dense 7497.37 7322.47 174.90 (2.39%)
recursive_join recursive-join-path 24007.98 24035.02 -27.04 (-0.11%)
recursive_join recursive-join-sparse 1065.07 1056.00 9.06 (0.86%)
recursive_join recursive-join-trail 7411.65 7294.89 116.76 (1.60%)
scan_after_filter q01 169.34 170.53 -1.19 (-0.70%)
scan_after_filter q02 160.29 155.05 5.24 (3.38%)
shortest_path_ldbc100 q37 96.42 90.35 6.07 (6.72%)
shortest_path_ldbc100 q38 347.00 371.71 -24.71 (-6.65%)
shortest_path_ldbc100 q39 63.57 61.64 1.92 (3.12%)
shortest_path_ldbc100 q40 438.17 400.90 37.26 (9.29%)
var_size_expr_evaluator q03 2108.91 2059.42 49.49 (2.40%)
var_size_expr_evaluator q04 2268.70 2222.65 46.04 (2.07%)
var_size_expr_evaluator q05 2670.24 2606.73 63.51 (2.44%)
var_size_expr_evaluator q06 1349.24 1317.42 31.82 (2.42%)
var_size_seq_scan q19 1477.74 1444.53 33.21 (2.30%)
var_size_seq_scan q20 2646.16 2679.22 -33.06 (-1.23%)
var_size_seq_scan q21 2305.28 2317.01 -11.73 (-0.51%)
var_size_seq_scan q22 131.70 126.87 4.83 (3.80%)

@royi-luo royi-luo requested a review from ray6080 January 8, 2025 18:19
Copy link

github-actions bot commented Jan 8, 2025

Benchmark Result

Master commit hash: decc6d5823880dbb9ae7194d12d608decb7ec5a8
Branch commit hash: 9b0e1e0566fa664ddd87e00b3c58ac94c1b91012

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 648.86 643.95 4.90 (0.76%)
aggregation q28 11864.60 11660.75 203.86 (1.75%)
filter q14 128.38 129.08 -0.71 (-0.55%)
filter q15 127.72 125.65 2.07 (1.65%)
filter q16 310.24 309.40 0.84 (0.27%)
filter q17 445.90 446.79 -0.89 (-0.20%)
filter q18 1938.03 1934.79 3.24 (0.17%)
filter zonemap-node 91.43 89.14 2.29 (2.57%)
filter zonemap-node-lhs-cast 89.51 89.31 0.20 (0.22%)
filter zonemap-node-null 85.80 85.19 0.60 (0.71%)
filter zonemap-rel 5744.98 5756.87 -11.89 (-0.21%)
fixed_size_expr_evaluator q07 582.94 576.03 6.91 (1.20%)
fixed_size_expr_evaluator q08 819.36 803.63 15.74 (1.96%)
fixed_size_expr_evaluator q09 821.74 807.16 14.59 (1.81%)
fixed_size_expr_evaluator q10 240.23 239.15 1.09 (0.45%)
fixed_size_expr_evaluator q11 232.67 233.61 -0.94 (-0.40%)
fixed_size_expr_evaluator q12 230.56 226.41 4.16 (1.84%)
fixed_size_expr_evaluator q13 1472.12 1459.02 13.10 (0.90%)
fixed_size_seq_scan q23 114.10 108.29 5.80 (5.36%)
join q29 652.96 617.79 35.17 (5.69%)
join q30 11331.82 10120.48 1211.34 (11.97%)
join q31 7.08 7.32 -0.23 (-3.21%)
join SelectiveTwoHopJoin 55.76 52.58 3.18 (6.04%)
ldbc_snb_ic q35 2607.25 2506.95 100.30 (4.00%)
ldbc_snb_ic q36 455.62 469.19 -13.57 (-2.89%)
ldbc_snb_is q32 6.54 3.87 2.67 (69.17%)
ldbc_snb_is q33 15.75 13.72 2.03 (14.76%)
ldbc_snb_is q34 1.24 1.50 -0.26 (-17.58%)
multi-rel multi-rel-large-scan 1332.28 1302.00 30.28 (2.33%)
multi-rel multi-rel-lookup 9.49 24.38 -14.89 (-61.09%)
multi-rel multi-rel-small-scan 81.96 76.69 5.27 (6.87%)
order_by q25 131.50 129.16 2.34 (1.81%)
order_by q26 463.92 448.84 15.07 (3.36%)
order_by q27 1461.06 1456.60 4.46 (0.31%)
recursive_join recursive-join-bidirection 313.73 281.94 31.79 (11.27%)
recursive_join recursive-join-dense 7434.13 7322.47 111.66 (1.52%)
recursive_join recursive-join-path 23896.01 24035.02 -139.01 (-0.58%)
recursive_join recursive-join-sparse 1077.56 1056.00 21.55 (2.04%)
recursive_join recursive-join-trail 7446.72 7294.89 151.83 (2.08%)
scan_after_filter q01 174.34 170.53 3.82 (2.24%)
scan_after_filter q02 159.08 155.05 4.03 (2.60%)
shortest_path_ldbc100 q37 87.96 90.35 -2.39 (-2.64%)
shortest_path_ldbc100 q38 373.62 371.71 1.90 (0.51%)
shortest_path_ldbc100 q39 60.35 61.64 -1.29 (-2.09%)
shortest_path_ldbc100 q40 456.82 400.90 55.92 (13.95%)
var_size_expr_evaluator q03 2098.32 2059.42 38.89 (1.89%)
var_size_expr_evaluator q04 2237.90 2222.65 15.24 (0.69%)
var_size_expr_evaluator q05 2563.58 2606.73 -43.16 (-1.66%)
var_size_expr_evaluator q06 1365.94 1317.42 48.53 (3.68%)
var_size_seq_scan q19 1450.27 1444.53 5.74 (0.40%)
var_size_seq_scan q20 2594.30 2679.22 -84.92 (-3.17%)
var_size_seq_scan q21 2268.23 2317.01 -48.78 (-2.11%)
var_size_seq_scan q22 125.11 126.87 -1.77 (-1.39%)

@@ -325,7 +325,7 @@ kU_CreateNodeTable
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint )? SP? ')' ;

kU_CreateRelTable
: CREATE SP REL SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_RelTableConnection SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' ;
: CREATE SP REL SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName SP? '(' SP? kU_RelTableConnection SP? ( ',' SP? kU_PropertyDefinitions SP? )? ( ',' SP? oC_SymbolicName SP? )? ')' (SP WITH SP? kU_ParsingOptions)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u use a separate PR to change all ParsingOptions to options. I no longer think ParsingOptions is a good name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have kU_Options that matches kU_ParsingOptions but without the surrounding (. Do you have a different suggestion for the rule name or did you mean to rewrite all instances of kU_ParsingOptions using the current kU_Options?

extension/fts/src/function/create_fts_index.cpp Outdated Show resolved Hide resolved
src/include/common/enums/rel_direction.h Outdated Show resolved Hide resolved
src/common/enums/rel_direction.cpp Outdated Show resolved Hide resolved
@@ -29,6 +34,10 @@ class RelTableCatalogEntry final : public TableCatalogEntry {
common::table_id_t getDstTableID() const { return dstTableID; }
bool isSingleMultiplicity(common::RelDataDirection direction) const;
common::RelMultiplicity getMultiplicity(common::RelDataDirection direction) const;

std::span<const common::RelDataDirection> getStorageDirections() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call these two

std::span<const common::RelDataDirection> getRelDataDirections
common::RelStorageDirection getStorageDirection

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way I was thinking of replacing RelStorageDirection with ExtendDirection since I noticed we have that. Do you think that's a reasonable idea or should we keep them separate?

@royi-luo royi-luo force-pushed the royi/fwd-rel-table branch 2 times, most recently from f7300f0 to 8fc9faa Compare January 9, 2025 19:28
Copy link

github-actions bot commented Jan 9, 2025

Benchmark Result

Master commit hash: d5acb796e384d3de68e7be15f6ba5c0ef6bcdc64
Branch commit hash: d9391829c81d79badafa90e82b3b35bbe0d101ab

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 648.16 655.32 -7.15 (-1.09%)
aggregation q28 12012.62 11494.18 518.44 (4.51%)
filter q14 127.25 138.10 -10.85 (-7.86%)
filter q15 130.96 139.28 -8.32 (-5.97%)
filter q16 304.23 317.88 -13.66 (-4.30%)
filter q17 448.88 454.64 -5.76 (-1.27%)
filter q18 1887.45 1954.54 -67.09 (-3.43%)
filter zonemap-node 88.60 99.50 -10.90 (-10.95%)
filter zonemap-node-lhs-cast 88.79 97.78 -8.98 (-9.19%)
filter zonemap-node-null 84.62 94.18 -9.56 (-10.16%)
filter zonemap-rel 5827.49 5740.84 86.65 (1.51%)
fixed_size_expr_evaluator q07 571.42 564.24 7.18 (1.27%)
fixed_size_expr_evaluator q08 800.43 810.79 -10.36 (-1.28%)
fixed_size_expr_evaluator q09 800.41 809.95 -9.54 (-1.18%)
fixed_size_expr_evaluator q10 240.36 244.92 -4.56 (-1.86%)
fixed_size_expr_evaluator q11 233.84 239.03 -5.19 (-2.17%)
fixed_size_expr_evaluator q12 226.42 234.93 -8.51 (-3.62%)
fixed_size_expr_evaluator q13 1461.56 1469.46 -7.89 (-0.54%)
fixed_size_seq_scan q23 111.62 116.99 -5.36 (-4.58%)
join q29 618.45 599.57 18.88 (3.15%)
join q30 11076.32 11008.46 67.86 (0.62%)
join q31 5.03 5.94 -0.91 (-15.34%)
join SelectiveTwoHopJoin 57.62 55.58 2.04 (3.66%)
ldbc_snb_ic q35 2631.32 2676.02 -44.69 (-1.67%)
ldbc_snb_ic q36 495.01 473.46 21.55 (4.55%)
ldbc_snb_is q32 6.92 5.63 1.29 (23.00%)
ldbc_snb_is q33 10.65 13.35 -2.70 (-20.25%)
ldbc_snb_is q34 1.33 1.20 0.13 (10.57%)
multi-rel multi-rel-large-scan 1353.51 1300.67 52.84 (4.06%)
multi-rel multi-rel-lookup 30.41 34.51 -4.10 (-11.87%)
multi-rel multi-rel-small-scan 98.66 83.97 14.68 (17.49%)
order_by q25 132.06 144.88 -12.81 (-8.84%)
order_by q26 455.61 482.19 -26.59 (-5.51%)
order_by q27 1458.00 1492.70 -34.70 (-2.32%)
recursive_join recursive-join-bidirection 313.68 283.60 30.08 (10.61%)
recursive_join recursive-join-dense 7375.86 5441.75 1934.11 (35.54%)
recursive_join recursive-join-path 23680.61 23804.62 -124.01 (-0.52%)
recursive_join recursive-join-sparse 1053.23 1064.18 -10.96 (-1.03%)
recursive_join recursive-join-trail 7341.90 6066.14 1275.76 (21.03%)
scan_after_filter q01 173.93 178.64 -4.71 (-2.63%)
scan_after_filter q02 157.59 164.87 -7.28 (-4.41%)
shortest_path_ldbc100 q37 78.47 101.96 -23.49 (-23.04%)
shortest_path_ldbc100 q38 359.69 339.09 20.60 (6.08%)
shortest_path_ldbc100 q39 51.30 66.28 -14.98 (-22.60%)
shortest_path_ldbc100 q40 410.39 355.23 55.16 (15.53%)
var_size_expr_evaluator q03 2047.86 2056.20 -8.34 (-0.41%)
var_size_expr_evaluator q04 2172.32 2237.42 -65.10 (-2.91%)
var_size_expr_evaluator q05 2552.01 2626.86 -74.84 (-2.85%)
var_size_expr_evaluator q06 1330.74 1354.91 -24.18 (-1.78%)
var_size_seq_scan q19 1443.60 1468.18 -24.59 (-1.67%)
var_size_seq_scan q20 2752.02 2604.30 147.72 (5.67%)
var_size_seq_scan q21 2316.66 2309.84 6.82 (0.30%)
var_size_seq_scan q22 125.79 132.66 -6.87 (-5.18%)

CMakeLists.txt Outdated
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

project(Kuzu VERSION 0.7.1.1 LANGUAGES CXX C)
project(Kuzu VERSION 0.7.1.2 LANGUAGES CXX C)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might have to bump this again before merge. Please double check against master branch when you're ready to merge the PR.

test/test_files/dml_rel/copy.test Outdated Show resolved Hide resolved
src/include/common/constants.h Outdated Show resolved Hide resolved
src/include/storage/store/rel_table.h Outdated Show resolved Hide resolved
src/storage/store/rel_table.cpp Show resolved Hide resolved
Copy link

Benchmark Result

Master commit hash: 2e07232500904b61b2ead641982e717e6c3469cb
Branch commit hash: 63c1ed3c5b23515246dc8ee32a7d34cb298c4c8b

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 654.30 656.13 -1.83 (-0.28%)
aggregation q28 12184.66 12013.56 171.10 (1.42%)
copy node-Comment 70977.60 N/A N/A
copy node-Forum 5483.82 N/A N/A
copy node-Organisation 1199.83 N/A N/A
copy node-Person 2121.07 N/A N/A
copy node-Place 1176.15 N/A N/A
copy node-Post 30015.31 N/A N/A
copy node-Tag 1231.97 N/A N/A
copy node-Tagclass 1147.23 N/A N/A
copy rel-comment-hasCreator 55237.14 N/A N/A
copy rel-comment-hasTag 86827.86 N/A N/A
copy rel-comment-isLocatedIn 70372.76 N/A N/A
copy rel-containerOf 16730.43 N/A N/A
copy rel-forum-hasTag 4034.31 N/A N/A
copy rel-hasInterest 3123.86 N/A N/A
copy rel-hasMember 121255.45 N/A N/A
copy rel-hasModerator 1280.36 N/A N/A
copy rel-hasType 217.13 N/A N/A
copy rel-isPartOf 227.28 N/A N/A
copy rel-isSubclassOf 271.76 N/A N/A
copy rel-knows 13986.55 N/A N/A
copy rel-likes-comment 172628.75 N/A N/A
copy rel-likes-post 70605.79 N/A N/A
copy rel-organisation-isLocatedIn 282.25 N/A N/A
copy rel-person-isLocatedIn 462.06 N/A N/A
copy rel-post-hasCreator 15531.83 N/A N/A
copy rel-post-hasTag 22980.32 N/A N/A
copy rel-post-isLocatedIn 18977.12 N/A N/A
copy rel-replyOf-comment 50526.09 N/A N/A
copy rel-replyOf-post 36825.32 N/A N/A
copy rel-studyAt 841.24 N/A N/A
copy rel-workAt 1595.50 N/A N/A
filter q14 138.31 129.19 9.12 (7.06%)
filter q15 143.19 131.96 11.23 (8.51%)
filter q16 314.79 313.12 1.67 (0.53%)
filter q17 458.32 457.78 0.54 (0.12%)
filter q18 1983.82 2004.97 -21.14 (-1.05%)
filter zonemap-node 100.52 90.92 9.60 (10.56%)
filter zonemap-node-lhs-cast 98.07 91.10 6.96 (7.64%)
filter zonemap-node-null 93.83 86.88 6.94 (7.99%)
filter zonemap-rel 5781.15 5773.69 7.46 (0.13%)
fixed_size_expr_evaluator q07 621.27 572.91 48.36 (8.44%)
fixed_size_expr_evaluator q08 868.83 819.23 49.60 (6.05%)
fixed_size_expr_evaluator q09 865.71 802.63 63.08 (7.86%)
fixed_size_expr_evaluator q10 261.38 237.11 24.26 (10.23%)
fixed_size_expr_evaluator q11 253.16 229.73 23.43 (10.20%)
fixed_size_expr_evaluator q12 243.03 226.76 16.27 (7.18%)
fixed_size_expr_evaluator q13 1535.98 1485.99 49.99 (3.36%)
fixed_size_seq_scan q23 122.51 114.75 7.75 (6.76%)
join q29 636.44 626.88 9.56 (1.53%)
join q30 11012.57 9926.17 1086.40 (10.94%)
join q31 5.19 5.96 -0.77 (-12.97%)
join SelectiveTwoHopJoin 53.06 53.13 -0.07 (-0.14%)
ldbc_snb_ic q35 2546.00 2538.32 7.68 (0.30%)
ldbc_snb_ic q36 472.19 473.06 -0.87 (-0.18%)
ldbc_snb_is q32 2.75 3.53 -0.78 (-22.11%)
ldbc_snb_is q33 9.84 11.15 -1.32 (-11.79%)
ldbc_snb_is q34 1.25 1.37 -0.12 (-8.74%)
multi-rel multi-rel-large-scan 1463.83 1305.98 157.85 (12.09%)
multi-rel multi-rel-lookup 19.23 19.35 -0.12 (-0.62%)
multi-rel multi-rel-small-scan 75.58 101.76 -26.17 (-25.72%)
order_by q25 150.27 136.65 13.62 (9.97%)
order_by q26 464.73 457.93 6.80 (1.49%)
order_by q27 1472.40 1491.74 -19.34 (-1.30%)
recursive_join recursive-join-bidirection 299.62 284.45 15.17 (5.33%)
recursive_join recursive-join-dense 7380.04 7462.05 -82.01 (-1.10%)
recursive_join recursive-join-path 23739.05 24232.52 -493.47 (-2.04%)
recursive_join recursive-join-sparse 1065.88 1076.97 -11.10 (-1.03%)
recursive_join recursive-join-trail 7327.54 7428.25 -100.71 (-1.36%)
scan_after_filter q01 183.12 176.54 6.58 (3.73%)
scan_after_filter q02 169.11 160.29 8.82 (5.51%)
shortest_path_ldbc100 q37 90.92 97.58 -6.67 (-6.83%)
shortest_path_ldbc100 q38 358.69 347.67 11.02 (3.17%)
shortest_path_ldbc100 q39 64.96 61.18 3.79 (6.19%)
shortest_path_ldbc100 q40 429.97 427.76 2.21 (0.52%)
var_size_expr_evaluator q03 2459.28 2120.81 338.47 (15.96%)
var_size_expr_evaluator q04 2294.23 2331.20 -36.97 (-1.59%)
var_size_expr_evaluator q05 3177.96 2699.55 478.42 (17.72%)
var_size_expr_evaluator q06 1596.85 1386.85 210.00 (15.14%)
var_size_seq_scan q19 1463.81 1464.94 -1.13 (-0.08%)
var_size_seq_scan q20 2703.67 2602.28 101.39 (3.90%)
var_size_seq_scan q21 2305.40 2292.04 13.36 (0.58%)
var_size_seq_scan q22 131.26 126.90 4.35 (3.43%)

Rel table changes

Partitioner changes

Update grammar

Create FTS index with single direction storage

Fix FTS integration + rename 'fwd' option to 'fwd_only'

Run clang-format

Fix test failures

Bump project version

Add storage direction to table info

Update table info tests

Self-review

rel table catalog stores vector of directions instead of storage direction

More code cleanup

Run clang-format

More code cleanup

Run clang-format

Address review comments
Copy link

Benchmark Result

Master commit hash: 114d0aa55496d5fc8dfefef28859c87a7d8cb12b
Branch commit hash: 20a0a2e14bdd4684a9db8d8fa6929e78b5b8ff8e

Query Group Query Name Mean Time - Commit (ms) Mean Time - Master (ms) Diff
aggregation q24 646.14 650.84 -4.70 (-0.72%)
aggregation q28 13558.27 12058.77 1499.50 (12.43%)
copy node-Comment 93748.93 N/A N/A
copy node-Forum 6947.84 N/A N/A
copy node-Organisation 1220.42 N/A N/A
copy node-Person 2267.42 N/A N/A
copy node-Place 1175.32 N/A N/A
copy node-Post 42297.86 N/A N/A
copy node-Tag 1228.46 N/A N/A
copy node-Tagclass 1175.60 N/A N/A
copy rel-comment-hasCreator 84706.64 N/A N/A
copy rel-comment-hasTag 96817.87 N/A N/A
copy rel-comment-isLocatedIn 75882.31 N/A N/A
copy rel-containerOf 16759.86 N/A N/A
copy rel-forum-hasTag 4098.96 N/A N/A
copy rel-hasInterest 3309.56 N/A N/A
copy rel-hasMember 124007.45 N/A N/A
copy rel-hasModerator 1297.09 N/A N/A
copy rel-hasType 279.84 N/A N/A
copy rel-isPartOf 292.62 N/A N/A
copy rel-isSubclassOf 255.80 N/A N/A
copy rel-knows 16081.66 N/A N/A
copy rel-likes-comment 197478.88 N/A N/A
copy rel-likes-post 71872.84 N/A N/A
copy rel-organisation-isLocatedIn 256.15 N/A N/A
copy rel-person-isLocatedIn 581.64 N/A N/A
copy rel-post-hasCreator 16041.96 N/A N/A
copy rel-post-hasTag 25031.04 N/A N/A
copy rel-post-isLocatedIn 18744.18 N/A N/A
copy rel-replyOf-comment 54542.45 N/A N/A
copy rel-replyOf-post 45246.41 N/A N/A
copy rel-studyAt 802.10 N/A N/A
copy rel-workAt 1615.26 N/A N/A
filter q14 127.44 128.39 -0.95 (-0.74%)
filter q15 131.10 129.89 1.20 (0.93%)
filter q16 300.44 307.23 -6.78 (-2.21%)
filter q17 447.07 444.78 2.29 (0.52%)
filter q18 1878.90 1866.46 12.45 (0.67%)
filter zonemap-node 89.21 89.13 0.08 (0.09%)
filter zonemap-node-lhs-cast 88.77 88.65 0.12 (0.13%)
filter zonemap-node-null 84.90 84.91 -0.02 (-0.02%)
filter zonemap-rel 5450.11 5678.73 -228.62 (-4.03%)
fixed_size_expr_evaluator q07 572.81 573.54 -0.72 (-0.13%)
fixed_size_expr_evaluator q08 800.78 803.75 -2.97 (-0.37%)
fixed_size_expr_evaluator q09 803.87 807.56 -3.69 (-0.46%)
fixed_size_expr_evaluator q10 237.29 237.66 -0.37 (-0.16%)
fixed_size_expr_evaluator q11 230.29 229.46 0.83 (0.36%)
fixed_size_expr_evaluator q12 229.58 227.07 2.51 (1.11%)
fixed_size_expr_evaluator q13 1464.82 1460.38 4.44 (0.30%)
fixed_size_seq_scan q23 116.11 112.40 3.70 (3.29%)
join q29 637.26 598.75 38.51 (6.43%)
join q30 10955.78 10962.68 -6.90 (-0.06%)
join q31 4.89 6.91 -2.02 (-29.26%)
join SelectiveTwoHopJoin 60.55 59.29 1.25 (2.11%)
ldbc_snb_ic q35 2517.53 2548.19 -30.66 (-1.20%)
ldbc_snb_ic q36 473.31 467.25 6.06 (1.30%)
ldbc_snb_is q32 7.24 6.11 1.13 (18.53%)
ldbc_snb_is q33 13.59 14.18 -0.58 (-4.12%)
ldbc_snb_is q34 1.18 1.36 -0.18 (-13.43%)
multi-rel multi-rel-large-scan 1328.96 1362.60 -33.63 (-2.47%)
multi-rel multi-rel-lookup 13.66 20.49 -6.83 (-33.34%)
multi-rel multi-rel-small-scan 101.94 66.82 35.12 (52.57%)
order_by q25 130.07 132.58 -2.51 (-1.89%)
order_by q26 452.65 456.04 -3.39 (-0.74%)
order_by q27 1520.32 1491.65 28.67 (1.92%)
recursive_join recursive-join-bidirection 284.53 275.63 8.90 (3.23%)
recursive_join recursive-join-dense 7472.94 7379.62 93.32 (1.26%)
recursive_join recursive-join-path 23822.32 23920.45 -98.13 (-0.41%)
recursive_join recursive-join-sparse 1054.85 1062.88 -8.04 (-0.76%)
recursive_join recursive-join-trail 7365.22 7363.00 2.22 (0.03%)
scan_after_filter q01 174.63 173.74 0.89 (0.51%)
scan_after_filter q02 157.32 158.15 -0.83 (-0.53%)
shortest_path_ldbc100 q37 83.91 79.86 4.05 (5.07%)
shortest_path_ldbc100 q38 372.90 351.52 21.38 (6.08%)
shortest_path_ldbc100 q39 64.32 68.36 -4.04 (-5.91%)
shortest_path_ldbc100 q40 437.92 450.22 -12.30 (-2.73%)
var_size_expr_evaluator q03 2063.73 2080.15 -16.43 (-0.79%)
var_size_expr_evaluator q04 2174.66 2161.11 13.56 (0.63%)
var_size_expr_evaluator q05 2589.30 2520.02 69.27 (2.75%)
var_size_expr_evaluator q06 1328.39 1342.89 -14.50 (-1.08%)
var_size_seq_scan q19 1442.34 1443.43 -1.10 (-0.08%)
var_size_seq_scan q20 2367.40 2638.11 -270.71 (-10.26%)
var_size_seq_scan q21 2273.23 2270.73 2.50 (0.11%)
var_size_seq_scan q22 123.79 125.06 -1.27 (-1.02%)

@royi-luo royi-luo merged commit c55d29f into master Jan 11, 2025
@royi-luo royi-luo deleted the royi/fwd-rel-table branch January 11, 2025 17:17
@royi-luo royi-luo mentioned this pull request Jan 14, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants