Re: LIKE pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Владимир-3 wrote
> It seems my quite complex query runs 10 times faster on "some_column 
> LIKE '%test_1' " vs "some_column LIKE 'test_1' "
> So I just add "%"  to the pattern...

Keep in mind then LIKE '%test_1' and LIKE 'test_1' are not equivalent, using
the % as a prefix to the argument means that the scan only has to confirm
that the value ends in 'test_1' where forgoing the % entirely means that you
are essentially saying some_column='test_1'.




--
View this message in context: http://postgresql.nabble.com/LIKE-pattern-tp5902225p5902701.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux