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 ...
随机推荐
- ppt类似工具AxeFile使用心得
一个所谓的傻瓜式过渡效果自动生成工具.定义好展示窗口大小,加入时序.所谓的闪烁效果,也是相当的滑稽. 是一个非专业的简单的快速PPT工具. 但是体现的确是扁平化的设计思路,很值得深思. ------ ...
- BZOJ 1644: [Usaco2007 Oct]Obstacle Course 障碍训练课( BFS )
BFS... 我连水题都不会写了QAQ ------------------------------------------------------------------------- #inclu ...
- wdcp centos6.5多网站部署
一.wdcp介绍 wdCP是WDlinux Control Panel的简称,是一套通过WEB控制和管理服务器的Linux服务器管理系统以及虚拟主机管理系统,旨在易于使用Linux系统做为我们的网站服 ...
- 在verilog中关于inout口的设计方法
在学习IIC的时候我们知道这么设计inout inout scl : reg scl_reg , scl_en ; scl = scl_en ? scl_reg : 1'dz ; 当 ...
- An update on OS X Code Signing(OS X代码签名)
There has recently been updates to the OS X code signing process. These updates also affect Qt appli ...
- SSL证书与Https应用部署小结
为了提高网站的安全性,一般会在比较敏感的部分页面采用https传输,比如注册.登录.控制台等.像Gmail.网银等全部采用https传输. https/ssl 主要起到两个作用:网站认证.内容加密传输 ...
- java学习之IO装饰设计模式
装饰设计模式就是对已有的对象的功能进行增强 当想要对已有的对象进行功能增强时,可以定义类,将已有对象传入,基于已有的功能,并提供加强功能.那么自定义的该类称为装饰类. 装饰类通常会通过构造方法接收被装 ...
- Courses(最大匹配)
Courses Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total S ...
- swift菜鸟入门视频教程-07-闭包
本人自己录制的swift菜鸟入门,欢迎大家拍砖.有什么问题能够在这里留言. 主要内容: 闭包表达式(Closure Expressions) 跟随闭包(Trailing Closures) 值捕获(C ...
- Android:源码环境下移植第三方的apk内置到ROM(System Image)中
1. 首先在vendor目录下新建一个the3rdapk的目录,将需要内置的apk丢进去,目录名自己随意定. 2. 在 build/target/product/common.mk最后面,在$(cal ...