【发布时间】:2014-02-17 15:01:27
【问题描述】:
我在 Postgresql 数据库中有 CLIENTS_WORDS 表,其中包含以下列:ID、CLIENT_ID、WORD
ID|CLIENT_ID|WORD
1 |1242 |word1
2 |1242 |WordX.foo
3 |1372 |nextword
4 |1999 |word1
在此表中可能有大约 100k-500k 行。
我有这样的查询字符串:
'Some people tell word1 to someone'
'Another stringWordX.foo too possible'
我希望从查询字符串中包含 WORD 列文本的表中选择 *。
现在我使用选择
select * from CLIENTS_WORDS
where strpos('Some people tell word1 to someone', WORD) > 0
我的问题,检索匹配行的最佳性能/快速方法在哪里?
【问题讨论】:
-
小写/大写重要吗?您的 Postgres 版本是什么?
-
忽略大小写,postgres 9.3 最新
标签: sql postgresql pattern-matching