Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35768

Vector key is not used upon selecting from views / subqueries

Details

    Description

      I had it in sign-off notes for MDEV-35450, but not as a JIRA item, but I think selecting from a view is a fairly realistic scenario and deserves at least being documented as a limitation if it hasn't been yet.

      create table t (b vector(1) not null, vector(b));
      insert into t values (0x31313131),(0x32323232);
      create view v as select * from t;
      explain select * from t order by vec_distance_euclidean(b,0x30303030) limit 1;
      explain select * from v order by vec_distance_euclidean(b,0x30303030) limit 1;
      explain select * from (select * from t) sq order by vec_distance_euclidean(b,0x30303030) limit 1;
      drop view v;
      drop table t;
      

      11.7 bc32705f46fa93d9700a20c8d439e48e5c352272

      create view v as select * from t;
      explain select * from t order by vec_distance_euclidean(b,0x30303030) limit 1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t	index	NULL	b	6	NULL	1	
      explain select * from v order by vec_distance_euclidean(b,0x30303030) limit 1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t	ALL	NULL	NULL	NULL	NULL	2	Using filesort
      explain select * from (select * from t) sq order by vec_distance_euclidean(b,0x30303030) limit 1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t	ALL	NULL	NULL	NULL	NULL	2	Using filesort
      

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.