Creating Spatial Indexes(mysql 创建空间索引 The used table type doesn't support SPATIAL indexes)
For MyISAM tables, MySQL can create spatial indexes using syntax similar to that for creating regular indexes, but extended with the SPATIAL keyword. Currently, columns in spatial indexes must be declared NOT NULL. The following examples demonstrate how to create spatial indexes:
With
CREATE TABLE:CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM;
With
ALTER TABLE:ALTER TABLE geom ADD SPATIAL INDEX(g);
With
CREATE INDEX:CREATE SPATIAL INDEX sp_index ON geom (g);
For MyISAM tables, SPATIAL INDEX creates an R-tree index. For storage engines that support nonspatial indexing of spatial columns, the engine creates a B-tree index. A B-tree index on spatial values will be useful for exact-value lookups, but not for range scans.
For more information on indexing spatial columns, see Section 13.1.8, “CREATE INDEX Syntax”.
To drop spatial indexes, use ALTER TABLE or DROP INDEX:
With
ALTER TABLE:ALTER TABLE geom DROP INDEX g;
With
DROP INDEX:DROP INDEX sp_index ON geom;
Example: Suppose that a table geom contains more than 32,000 geometries, which are stored in the column g of type GEOMETRY. The table also has an AUTO_INCREMENT column fid for storing object ID values.
mysql>DESCRIBE geom;
+-------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+----------------+
| fid | int(11) | | PRI | NULL | auto_increment |
| g | geometry | | | | |
+-------+----------+------+-----+---------+----------------+
2 rows in set (0.00 sec) mysql>SELECT COUNT(*) FROM geom;
+----------+
| count(*) |
+----------+
| 32376 |
+----------+
1 row in set (0.00 sec)
To add a spatial index on the column g, use this statement:
mysql>ALTER TABLE geom ADD SPATIAL INDEX(g);
Query OK, 32376 rows affected (4.05 sec)
Records: 32376 Duplicates: 0 Warnings: 0
Creating Spatial Indexes(mysql 创建空间索引 The used table type doesn't support SPATIAL indexes)的更多相关文章
- mysql The used table type doesn’t support FULLTEXT indexes 解决方案 (phpstudy 会出现),coten不会
mysql The used table type doesn't support FULLTEXT indexes 是不支持全文索引,解决方案: 1.停掉mysql服务2.打开my.ini,搜索de ...
- #1214 - The used table type doesn't support FULLTEXT indexes解决办法
#1214 - The used table type doesn't support FULLTEXT indexes报此错误的原因是:InnoDB不支持FULLTEXT类型的索引. 网上的解决办法 ...
- [Err] 1214 - The used table type doesn't support FULLTEXT indexes
-- -- Table structure for table `film_text` -- -- InnoDB added FULLTEXT support in 5.6.10. If you us ...
- Mysql创建表时报错Table doesn't exist解决办法
最近做项目时,本地数据库出了毛病,PHPMyadmin中有几张表不见了,我想应该是误删了吧,于是准备重新建一张表,可是问题出现了,sql报错,说表不存在... 什么鬼!就是因为表不存在我才要创建的好吗 ...
- mysql创建索引以及对索引的理解
创建表的时候创建索引 创建索引是指在某个表的一列或多列上建立一个索引,以便提高对表的访问速度.创建索引有3种方式,这3种方式分别是创建表的时候创建索引.在已经存在的表上创建索引和使用ALTER T ...
- mysql创建/删除表的例子
创建表 简单的方式 CREATE TABLE person ( number INT(11), name VARCHAR(255), birthday DATE ); 或者是 CREATE TABLE ...
- mysql创建和删除表
创建表 简单的方式 CREATE TABLE person ( ), name ), birthday DATE ); 或者是 CREATE TABLE IF NOT EXISTS person ( ...
- mysql创建表分区
MySQL创建表分区 create table erp_bill_index( id int primary key auto_increment, addtime datetime ); inser ...
- mysql对GIS空间数据的支持,包括创建空间索引
CREATE TABLE tb_geo( id INT PRIMARY KEY AUTO_INCREMENT, NAME ) NOT NULL, pnt POINT NOT NULL, SPATIAL ...
随机推荐
- python中decorator
先讲一下python中的@符号 看下面代码 @f @f2 def fun(args, args2, args3, args4, ……): pass 上面代码相当于 def fun(args, args ...
- uoj #2 【NOI2014】起床困难综合症 贪心+位运算
题目链接 给出n个数, 每个数有特定的一种操作, &|^三种, 给出一个m, 初始值属于[0,m],选定一个初始值, 使所有操作做完之后的值最大, 输出这个最大值. 1, 从最高位贪心, 如果 ...
- C陷阱与缺陷(一)
第一章 词法陷阱 术语“符号”指的是程序的一个基本组成单元,其作用相当于一个句子中的单词.编译器中负责将程序分解为一个一个符号的部分,一般称为“词法分析器”. 1.1 =不同于== 一般容易将比较运算 ...
- js中的一元运算符
一元运算符只有一个参数,即要操作的对象或值.它们是 ECMAScript 中最简单的运算符. delete delete 运算符删除对以前定义的对象属性或方法的引用.例如: var o = new O ...
- js 选择器
a>b 获取a下面的直接子元素
- windowsphone中获取手机位置信息
首先在界面中加入一个textblock控件以显示信息 using System; using System.Collections.Generic; using System.IO; using Sy ...
- postgresql文档生成注意事项
如果要生成中文版的postgresql,目前我所知道的方法见我的一篇博客http://www.cnblogs.com/codeblock/p/4812445.html 里面有详细的介绍,但是生成的文档 ...
- .net 弹窗方式
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请输入 ...
- [Swust OJ 643]--行列式的计算(上三角行列式变换)
题目链接:http://acm.swust.edu.cn/problem/643/ Time limit(ms): 1000 Memory limit(kb): 65535 Description ...
- Python 字符、整型、列表字典等操作(二)
在上次课程中简要的讲述了Python的基础常识,现在来详细的学习一下吧! 一.类和对象 面向过程和面向对象 面向过程:C 面向对象:Java.Python等 类和对象的含义: 类,是对事物的抽象,比如 ...