I have written down one article on how can we optimize pattern searching queries in PostgreSQL. If you are using PostgreSQL as your relational database in your Rails app, you must give it a read.
Any comments, suggestions or reviews are most welcome and appreciated.
Link for the article: Optimizing our pattern searching queries
Thanks & happy coding!