H
Harshel Mike

Posted on 27th February 2024|220 views

0
votes

Postgresql Like Case Insensitive

Which is better ILIKE or Case_insensitive query in PostgreSQL?

Answers
P
naseer mohammad

Posted on 27th February 2024

  • According to active spot, instead of LIKE you can use ILIKE PostgreSQL, you can understand that ILIKE can be used to change the case from upper to lower or vice versa. Still, by using ILIKE, you can see that the ILIKE is a slower process, now let us assume that ILIKE used for extended expressions then it consumes a lot of time. So, to overcome this, it is wise to use LOWER() Function, which is way faster than the ILIKE function. 

Syntax:

SELECT id FROM groups where name ILIKE 'name.'

Hence, you can use this, but this is way slower than case_insensitive query.

  • Case_insensitive query used to change the case of the name as required from lower to upper or vice versa. Moreover, this is faster as compared to ILIKE and LIKE.

Syntax:

SELECT id FROM groups WHERE LOWER(name) = 'name';

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos