Linked Questions
10 questions linked to/from PostgreSQL wildcard LIKE for any of a list of words
170 votes
8 answers
181k views
PostgreSQL LIKE query performance variations
I have been seeing quite a large variation in response times regarding LIKE queries to a particular table in my database. Sometimes I will get results within 200-400 ms (very acceptable) but other ...
8 votes
2 answers
12k views
Query for iLike list in PostgreSQL
I'm writing an inefficient query as follows: WHERE (Field iLIKE '%cat%' OR Field iLIKE '%dog%' OR Field iLIKE '%animal%' OR Field iLIKE '%pet%') whereas what I would like to write is: WHERE Field ...
0 votes
3 answers
2k views
Case insensitive search using IN operator in Ruby on Rails and PostgreSQL
I'm new to ROR and trying to implement search in PostgreSQL database using Active Record. I've found that to make search case insensitive I can use ILIKE operator instead of equals and LIKE but not ...
0 votes
3 answers
4k views
Match a list of patterns using SQL IN and LIKE
Is it possible to match a list of patterns in SQL? I know of the following way to match a single pattern: SELECT * FROM table where title LIKE '%match%' This can be expanded like: SELECT * FROM table ...
3 votes
1 answer
1k views
PostgreSQL wildcard LIKE for any of a list of words returned by Subquery
This is very much like PostgreSQL wildcard LIKE for any of a list of words, except instead of wanting to match on a static list of words, I want to match on a list of words returned by a subquery. ...
1 vote
2 answers
1k views
How can I search for arrays that contain strings found in my search key? [duplicate]
Say I have a Product table with a json array attribute called "name". For example, Product.first.name == ["large", "black", "hoodie"]. I want to search through my database for Products with names that ...
0 votes
1 answer
2k views
Using "similar to" or "~*" in jpql
I am using postgresql with jpa in playframework 2.2. I am trying to use like with in in my JPQL by using similar to something like this thread. select * from table where lower(value) similar to '%(foo|...
0 votes
2 answers
1k views
Comparing data in a column of one table with the same column in another table
I have two tables temp and md respectively. There is a field called uri_stem which has certain details that I want to omit from temp but not from md. I need to make a comparison that is able to ...
0 votes
4 answers
113 views
Filtering records based on all members of association
I have a model called Story, which has — and belongs to many — Tags. I'm trying to create functionality to display only certain stories based on the story attributes. I do this by chaining ...
0 votes
1 answer
55 views
Matching string against keywords
I have a field which contains text string, for example: Credit for an item Credit for menu Debit for food Credit for food Debit for Delivery Etc. I want to categorize them into two categories ...