Does MongoDB work poorly on 600k alternate DB objects? optimization?

I started a new project using node.js and mongodb, and after almost 2 days I collected about 600 thousand objects in MongoDB. I already notice a huge (negative) impact on performance, and I'm starting to worry if I have to move to another database, if I can, or if I have to stick to Mongo and do some (more) optimizations.

Basically I save the following coordinates:

[x1] => 687
[y1] => 167
[x2] => 686
[y2] => 167
[c] => 0
[s] => 0
[m] => 1299430700312
[_id] => MongoId Object (
    [$id] => 4d73bd2c82bb5926780001ec
)

No more ... and my queries look like this:

{'$or': [ { x1: {'$gte' : 0, '$lt' : 1000 }, y1: {'$gte' : 0, '$lt' : 1000 } , { x2: {'$gte' : 0, '$lt' : 1000 }, y2: {'$gte' : 0, '$lt' : 1000 } } ] }

: x1, y1, y1, y1, : {x1:1,y1:1},{x2:1,y2:1}. , ... ~ 40 . 2-8 . Btw: PHP Out-of-Memory (256 ).

- Intel i7 Intel® R7 Core (TM) 8 8 , ;)

, . , , , . MySQL ? NoSQL?

, , "2-8secs " - . , 4 10 , .

+5
2

, . , , , . , mongodb, !

: . :


[x1] => 190
[y1] => 18
[x2] => 192
[y2] => 18
[c] => 0
[s] => 0
[b] => Array (
    [0] => 0
    [1] => 0
)
[m] => 1299365242802
[r] => 32596
[_id] => MongoId Object (
    [$id] => 4d72bd7af0528ea82f000003
)

:


{x1:1,y1:1}, {x2:1,y2:1}

:


[_id] => MongoId Object (
    [$id] => 4d825799b15953b90d000000
)
[coords] => Array (
    [x] => 190
    [y] => 18
)
[x2] => 192
[y2] => 18
[s] => 0
[c] => 0
[m] => 1299365242802
[r] => 32596

:


{coords:'2D'}

. 400x400 , :


real    0m0.375s
user    0m0.348s
sys     0m0.021s


script , :

real    0m0.107s
user    0m0.096s
sys     0m0.012s

, 3200 (). / 2 ( 12 ). , . !:)

, Stackoverflow! )

+9

( /) index "x1", "x2", "y1" "y2", , , .

0

All Articles