A common operation for multi-dimensional vectors is to find k nearest vectors to the given one.
This task is about implementing indexes that allow to do it fast.
ideally they'll be engine independent
indexes should be update-able
in this task we'll only do Euclidean distance
we'll benchmark it on real multi-million-rows data sets
what algorithm, exactly, to use is still unclear
Attachments
Issue Links
relates to
MDEV-32886VEC_FromText() and VEC_ToText() functions
metadata is stored in the frm, read from frm, type checks (only BLOB and NOT NULL) SHOW commands and INFORMATION_SCHEMA.STATISTICS
Sergei Golubchik
added a comment - metadata is stored in the frm, read from frm, type checks (only BLOB and NOT NULL )
SHOW commands and INFORMATION_SCHEMA.STATISTICS
Algorithm implementation needs to provide methods for
add a vector to the graph
remove a vector from a graph
update — only if there will be some algorithm that can do it much faster that delete+insert
build a graph from a set of vectors
The server will provide methods for
read/update list of edges for a specific node
Sergei Golubchik
added a comment - An API for a graph algorithm.
Algorithm implementation needs to provide methods for
add a vector to the graph
remove a vector from a graph
update — only if there will be some algorithm that can do it much faster that delete+insert
build a graph from a set of vectors
The server will provide methods for
read/update list of edges for a specific node
@@ -136,7 +136,6 @@ class Item_func_vec_totext: public Item_str_ascii_checksum_func
class Item_func_vec_fromtext: public Item_str_func
{
- String tmp_js;
public:
bool fix_length_and_dec(THD *thd) override;
Item_func_vec_fromtext(THD *thd, Item *a);
Should be tested with maribackup (high posibility of fail with the new ndex)
Should be tested with mariadb-dump (probably pass, but will check that what
was printed by SHOW CREATE TABLE willbe read back)
It would be nice to have test with different types of indexses in one table
and they used by optimiser (I also do not expect problems, just to have it
checked).
IMHO VECTOR(N) type should be done before release to avoid table converting
on upgrade in the future.
IMHO this cleanups a bit fixes and better be backported if possible:
cleanup: remove unconditional #ifdef's
cleanup: key algorithm vs key flags
Oleksandr Byelkin
added a comment - - edited Here is my review:
This
share->total_keys > share->keys
to->s->keys == to->s->total_keys
better cnvert to SHARE::has_hlindex() or something like that
I am not sure about this changes (at least buffer size should be increaed to
better reflect default length of vector test representation):
diff --git a/sql/item_vectorfunc.cc b/sql/item_vectorfunc.cc
index 8b9ea188490..315ad4e06fa 100644
--- a/sql/item_vectorfunc.cc
+++ b/sql/item_vectorfunc.cc
@@ -134,6 +134,9 @@ String *Item_func_vec_fromtext::val_str(String *buf)
{
json_engine_t je;
bool end_ok= false;
+ char buff[STRING_BUFFER_USUAL_SIZE]; // maynbe *2 or *3 has more sens
+ // (usual vector representation)
+ String tmp_js(buff,sizeof(buff), &my_charset_bin);
String *value = args[0]->val_json(&tmp_js);
CHARSET_INFO *cs= value->charset();
diff --git a/sql/item_vectorfunc.h b/sql/item_vectorfunc.h
index 58dc300c451..1687eed7e29 100644
--- a/sql/item_vectorfunc.h
+++ b/sql/item_vectorfunc.h
@@ -136,7 +136,6 @@ class Item_func_vec_totext: public Item_str_ascii_checksum_func
class Item_func_vec_fromtext: public Item_str_func
{
- String tmp_js;
public:
bool fix_length_and_dec(THD *thd) override;
Item_func_vec_fromtext(THD *thd, Item *a);
Should be tested with maribackup (high posibility of fail with the new ndex)
Should be tested with mariadb-dump (probably pass, but will check that what
was printed by SHOW CREATE TABLE willbe read back)
It would be nice to have test with different types of indexses in one table
and they used by optimiser (I also do not expect problems, just to have it
checked).
IMHO VECTOR(N) type should be done before release to avoid table converting
on upgrade in the future.
IMHO this cleanups a bit fixes and better be backported if possible:
cleanup: remove unconditional #ifdef's
cleanup: key algorithm vs key flags
People
Sergei Golubchik
Sergei Golubchik
Votes:
2Vote for this issue
Watchers:
19Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1274.2999997138977,"ttfb":454.09999990463257,"pageVisibility":"visible","entityId":126632,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"561a21ec-92ff-4f6b-9db8-58debe5a670e","navigationType":0,"readyForUser":1412.0999999046326,"redirectCount":0,"resourceLoadedEnd":1769.9000000953674,"resourceLoadedStart":459,"resourceTiming":[{"duration":342.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":459,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":459,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":801.5,"responseStart":0,"secureConnectionStart":0},{"duration":342.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":459.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":459.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":801.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":351.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":459.40000009536743,"connectEnd":459.40000009536743,"connectStart":459.40000009536743,"domainLookupEnd":459.40000009536743,"domainLookupStart":459.40000009536743,"fetchStart":459.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":459.40000009536743,"responseEnd":810.9000000953674,"responseStart":810.9000000953674,"secureConnectionStart":459.40000009536743},{"duration":389.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":459.59999990463257,"connectEnd":459.59999990463257,"connectStart":459.59999990463257,"domainLookupEnd":459.59999990463257,"domainLookupStart":459.59999990463257,"fetchStart":459.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":459.59999990463257,"responseEnd":849.1999998092651,"responseStart":849.1999998092651,"secureConnectionStart":459.59999990463257},{"duration":393.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":459.7999997138977,"connectEnd":459.7999997138977,"connectStart":459.7999997138977,"domainLookupEnd":459.7999997138977,"domainLookupStart":459.7999997138977,"fetchStart":459.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":459.7999997138977,"responseEnd":853.0999999046326,"responseStart":853.0999999046326,"secureConnectionStart":459.7999997138977},{"duration":393.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":460,"connectEnd":460,"connectStart":460,"domainLookupEnd":460,"domainLookupStart":460,"fetchStart":460,"redirectEnd":0,"redirectStart":0,"requestStart":460,"responseEnd":853.5999999046326,"responseStart":853.5999999046326,"secureConnectionStart":460},{"duration":393.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":460.09999990463257,"connectEnd":460.09999990463257,"connectStart":460.09999990463257,"domainLookupEnd":460.09999990463257,"domainLookupStart":460.09999990463257,"fetchStart":460.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":460.09999990463257,"responseEnd":853.9000000953674,"responseStart":853.9000000953674,"secureConnectionStart":460.09999990463257},{"duration":494.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":460.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":460.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":954.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":394,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":460.5,"connectEnd":460.5,"connectStart":460.5,"domainLookupEnd":460.5,"domainLookupStart":460.5,"fetchStart":460.5,"redirectEnd":0,"redirectStart":0,"requestStart":460.5,"responseEnd":854.5,"responseStart":854.5,"secureConnectionStart":460.5},{"duration":494.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":460.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":460.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":955,"responseStart":0,"secureConnectionStart":0},{"duration":394.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":460.90000009536743,"connectEnd":460.90000009536743,"connectStart":460.90000009536743,"domainLookupEnd":460.90000009536743,"domainLookupStart":460.90000009536743,"fetchStart":460.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":460.90000009536743,"responseEnd":855,"responseStart":855,"secureConnectionStart":460.90000009536743},{"duration":984.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":472.5,"connectEnd":472.5,"connectStart":472.5,"domainLookupEnd":472.5,"domainLookupStart":472.5,"fetchStart":472.5,"redirectEnd":0,"redirectStart":0,"requestStart":472.5,"responseEnd":1457,"responseStart":1457,"secureConnectionStart":472.5},{"duration":1289.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":480.59999990463257,"connectEnd":480.59999990463257,"connectStart":480.59999990463257,"domainLookupEnd":480.59999990463257,"domainLookupStart":480.59999990463257,"fetchStart":480.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":480.59999990463257,"responseEnd":1769.9000000953674,"responseStart":1769.9000000953674,"secureConnectionStart":480.59999990463257},{"duration":493.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":966.4000000953674,"connectEnd":966.4000000953674,"connectStart":966.4000000953674,"domainLookupEnd":966.4000000953674,"domainLookupStart":966.4000000953674,"fetchStart":966.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":966.4000000953674,"responseEnd":1460,"responseStart":1460,"secureConnectionStart":966.4000000953674},{"duration":537.2000002861023,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1268.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1268.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1805.5,"responseStart":0,"secureConnectionStart":0},{"duration":407.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1463.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1463.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1870.5,"responseStart":0,"secureConnectionStart":0},{"duration":390,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1464.2999997138977,"connectEnd":1464.2999997138977,"connectStart":1464.2999997138977,"domainLookupEnd":1464.2999997138977,"domainLookupStart":1464.2999997138977,"fetchStart":1464.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1464.2999997138977,"responseEnd":1854.2999997138977,"responseStart":1854.2999997138977,"secureConnectionStart":1464.2999997138977},{"duration":393.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1464.7999997138977,"connectEnd":1464.7999997138977,"connectStart":1464.7999997138977,"domainLookupEnd":1464.7999997138977,"domainLookupStart":1464.7999997138977,"fetchStart":1464.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1464.7999997138977,"responseEnd":1858.6999998092651,"responseStart":1858.6999998092651,"secureConnectionStart":1464.7999997138977}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":204,"responseStart":454,"responseEnd":480,"domLoading":457,"domInteractive":1815,"domContentLoadedEventStart":1815,"domContentLoadedEventEnd":1870,"domComplete":2302,"loadEventStart":2302,"loadEventEnd":2303,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1784.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1785.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1785.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1788.4000000953674},{"name":"activityTabFullyLoaded","time":1889.5999999046326}],"measures":[],"correlationId":"de8ff5fbff8683","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":181,"dbReadsTimeInMs":45,"dbConnsTimeInMs":60,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}