V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
q1450718943
V2EX  ›  MySQL

MySQL 空间索引求解

  •  
  •   q1450718943 · 98 天前 · 560 次点击
    这是一个创建于 98 天前的主题,其中的信息可能已经有所发展或是发生改变。

    建表语句如下

    CREATE TABLE `nearby_user` (
      `id` int NOT NULL AUTO_INCREMENT,
      `name` varchar(30) NOT NULL DEFAULT '',
      `location` geometry NOT NULL,
      PRIMARY KEY (`id`),
      SPATIAL KEY `location` (`location`)
    ) ENGINE=InnoDB AUTO_INCREMENT=60001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
    

    查询语句

    explain SELECT name, ST_AsText(location)
    FROM nearby_user
    WHERE MBRContains(ST_GeomFromText('Polygon((30000 15000,
                     31000 15000,
                     31000 16000,
                     30000 16000,
                     30000 15000))'), location);
    

    60w 数据不走索引,possible_keys 和 key 都是 null

    MySQL 版本:8.0.35-0ubuntu0.22.04.1

    有了解 MySQL 空间索引的大佬可以解答一下吗?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5394 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:01 · PVG 15:01 · LAX 00:01 · JFK 03:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.