code-and-effect / effective_datatables

An effective ActiveRecord to Datatables dsl for Ruby on Rails. Make intelligent tables quickly.
MIT License
133 stars 36 forks source link

speeding up fuzzy searches #163

Closed nekapoor closed 2 years ago

nekapoor commented 3 years ago

Hello! I have a Postgres database and a table with a uid column that indexed. This table has ~10 million records and fuzzy searching is turned on for the uid column. Searching seems to be slow. Sorry if this is more of a database question, but is there anything else I can do to speed up the query on a search?

Or should I just turn off fuzzy searching?

Thanks!

matt-riemer commented 3 years ago

Turning off fuzzy search is probably the quickest fix, but then user would need to paste in the full UUID of a record they were searching for.

col :id, search: { fuzzy: false }

https://dba.stackexchange.com/questions/102448/how-should-i-index-a-uuid-in-postgres

I think you want to use a postgres uuid column with a regular b-tree index on it.

Hope this helps. Good luck! :)

nekapoor commented 3 years ago

thank you!