postgrespro / imgsmlr

Similar images search for PostgreSQL
Other
257 stars 41 forks source link

Query speed is too slow. #7

Open hfang8080 opened 6 years ago

hfang8080 commented 6 years ago

I'm sorry to bother you. I used this extension for 400 million img, and index on signature with gist. But I found that query on signature is very low (cost more than 30 seconds for query like: select sig <-> '(0.631970, 1.085420, 0.449103, 0.885163, 0.797899, 0.571842, 0.879878, 1.050410, 0.438902, 0.540778, 0.641945, 0.395742, 0.133787, 1.013711, 0.191292, 0.326252)' as dist from img_table order by dist limit 1;. By explain, I see it's using Index Scan).

I think the root cause is that: after we "Normalize" intensiveness in the pattern, the signatures becomes too concentrated in Gist index. It hits too many blocks in memory to get the result.

Is it possible to skip the normalization step when producing Pattern & Signature? Or other solution to solve the performance issue? Thanks!