Pattern Match Searching
PostgreSQL supports a lot of search types, and we’ll dive into them in this section. Pattern matching using LIKE and ILIKE is supported along with regular expressions.
These are useful when the user who’s searching knows exactly what to search for. Let’s consider an example.
Imagine a search for the first name of “Jane” within Rideshare users. That search could be a LIKE query. Match on the string Jane%, which has the name Jane and the wildcard character % on the right side.
Jane may not be a common value in your data. If you run data generators in Rideshare, you’ll have at least 20K users. If needed, populate users by running bin/rails data_generators:generate_all, then psql $DATABASE_URL -c ’ANALYZE users’. Use what ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access