select edges.*, nodes.*
from grids join edges on grids.edge=edges.id
join nodes on edges.startnode=nodes.id or edges.endnode=nodes.id
where grids.x>231 and grids.x<240 and grids.y>129 and grids.y<136edges和nodes的id是主键我给grids的edge,edges的startnode和endnode做了索引,但一点感觉也没有现在的数据量大约grids和edges各二十多万,nodes十多万应该怎么做索引好,或者sql该怎么改?我用的是SQLite,想想就这个版比较接近一点
from grids join edges on grids.edge=edges.id
join nodes on edges.startnode=nodes.id or edges.endnode=nodes.id
where grids.x>231 and grids.x<240 and grids.y>129 and grids.y<136edges和nodes的id是主键我给grids的edge,edges的startnode和endnode做了索引,但一点感觉也没有现在的数据量大约grids和edges各二十多万,nodes十多万应该怎么做索引好,或者sql该怎么改?我用的是SQLite,想想就这个版比较接近一点
解决方案 »
- 构架一个小型服务器
- delete data from tb的问题!
- MySql创建存储过程问题 急!
- 诡异的update,明明设置set `username` = 'username',但是执行完毕更新到数据库就username列的值就是0
- 本人用C写了一个操作mysql数据库的程序,发现在对mysql进行高频繁的查找、插入数据时,会出现“mysql lost connection”、“……gone awa
- MySQL的可视化问题
- SQL中含有特殊字符,进行查询时会出错,怎么办?
- 奇怪,下面語句在MYSQL中為何提示有錯,在MSSQL中是正常執行的...?
- Apache 1.3.2+PHP4.0.6+MySql 为什么老是报告MYSQL错误!?
- 读写分离都是在什么情境下使用?
- 关于两个表联合查询的问题!
- 求助 数据库语句如何写?
from grids join edges on grids.edge=edges.id
join nodes on edges.startnode=nodes.id or edges.endnode=nodes.id
where grids.x>231 and grids.x<240 and grids.y>129 and grids.y<136贴出来看一下,另外再把show index from tablename 相关的表的索引情况也贴出来。
from (select edge from grids where x>231 and x<240 and y>129 and y<136 ) as t
join edges on t.edge=edges.id
join nodes on edges.startnode=nodes.id or edges.endnode=nodes.id