什么是空间索引以及何时使用它?

时间:2022-04-05 17:22:06

Like most of the average PHP web developers I use MySql as a RDBMS. MySql (as other RDBMS also) offers SPATIAL INDEX features, but I'm don't get it very well. I have googled for it but didn't find clear real world examples to clarify my bad knowledge about it.

像大多数普通的PHP Web开发人员一样,我使用MySql作为RDBMS。 MySql(也像其他RDBMS一样)提供了SPATIAL INDEX功能,但我不是很好。我已经google了,但没有找到明确的现实世界的例子来澄清我对它的不良知识。

Could someone explain me a little bit what is a SPATIAL INDEX and when should I use it?

有人可以解释一下什么是空间索引,我什么时候应该使用它?

3 个解决方案

#1


17  

You can use a spatial index for indexing geo-objects - shapes. The spatial index makes it possible to efficiently search for objects that overlap in space

您可以使用空间索引来索引地理对象 - 形状。空间索引使得有效搜索空间重叠的对象成为可能

#2


6  

Spatial Index is like an ordinary index with this difference that Spatial objects are not 1D data points rather are in higher dimension space (e.g. 2D) and thus Ordinary indexes such as BTree are not appropriate for indexing such data. The well-known spatial Index technique is R-tree ( Google it on wikipedia )

空间索引就像普通索引,具有这种差异,即空间对象不是1D数据点而是在更高维度空间(例如2D)中,因此诸如BTree的普通索引不适合索引这样的数据。众所周知的空间索引技术是R-tree(谷歌在*上)

#3


-3  

The use of spacial index is best for searching exact matching value look-up,not for range scan.It is mainly supported in MyISAM tables but from MySQL 5.7.4 LAB release,it is also supported by Innodb.

空间索引的使用最适合搜索精确匹配值查找,而不是范围扫描。它主要在MyISAM表中支持,但是从MySQL 5.7.4 LAB版本支持,Innodb也支持它。

References:- http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html http://mysqlserverteam.com/innodb-spatial-indexes-in-5-7-4-lab-release/

参考文献: - http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html http://mysqlserverteam.com/innodb-spatial-indexes-in-5-7-4-实验室发布/

#1


17  

You can use a spatial index for indexing geo-objects - shapes. The spatial index makes it possible to efficiently search for objects that overlap in space

您可以使用空间索引来索引地理对象 - 形状。空间索引使得有效搜索空间重叠的对象成为可能

#2


6  

Spatial Index is like an ordinary index with this difference that Spatial objects are not 1D data points rather are in higher dimension space (e.g. 2D) and thus Ordinary indexes such as BTree are not appropriate for indexing such data. The well-known spatial Index technique is R-tree ( Google it on wikipedia )

空间索引就像普通索引,具有这种差异,即空间对象不是1D数据点而是在更高维度空间(例如2D)中,因此诸如BTree的普通索引不适合索引这样的数据。众所周知的空间索引技术是R-tree(谷歌在*上)

#3


-3  

The use of spacial index is best for searching exact matching value look-up,not for range scan.It is mainly supported in MyISAM tables but from MySQL 5.7.4 LAB release,it is also supported by Innodb.

空间索引的使用最适合搜索精确匹配值查找,而不是范围扫描。它主要在MyISAM表中支持,但是从MySQL 5.7.4 LAB版本支持,Innodb也支持它。

References:- http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html http://mysqlserverteam.com/innodb-spatial-indexes-in-5-7-4-lab-release/

参考文献: - http://dev.mysql.com/doc/refman/5.5/en/creating-spatial-indexes.html http://mysqlserverteam.com/innodb-spatial-indexes-in-5-7-4-实验室发布/