Create a table with 3D points:
create table points (coords pointz);
select CreateSpatialIndex('points', 'coords');
Insert 13k rows:
insert into points values (geometryfromtext('pointz(...)'))
Do
SELECT
p.rowid, count(*)
FROM
points p, points v
WHERE
distance(v.coords, p.coords) < 1
GROUP BY
p.rowid;
Will see an output of several (1..10) points per second (will take a few hours to process 13K points). EXPLAIN shows that the index is not used. A query with PTDistanceWithin function works the same way.
How can I use the spatial index? I checked if it's possible to use an MBR, but those functions are for 2D only.
added: here's a function reference, and all the functions I could use in usual case, work in 2D only!