How can I improve regex query performance in PostgreSQL 8?

I am performing a regular expression in a type column character varying(256)in PostgreSQL 8.3.3. There are currently no indexes in the column. I would like to improve the performance of this request if I can.

Will index support be added? Are there other things that I can try to improve performance?

+5
source share
6 answers

You cannot create an index that speeds up any common regular expression; however, if you have one or a limited number of regular expressions with which you agree, you have several options.

, , , . .

, , , . , , . , GiST, .

+5

. .

, , , , , , .

+4

. , .

0

, RegEx. reg-ex? , .

0

, , , , , , . .

, ( , ), . ( ).

If the regular expression is dynamically generated from user input, you may need to scan the table or modify the user application to create a simpler search, for example, the field 'value%', which will use the index in the field ('% value%' will not).

0
source

If you can reduce your needs to a simple LIKE query, find the indexes with text_pattern_ops to speed them up.

0
source

All Articles