0

I have a really simple problem: Replace XX_FistName LastName (maybe dr. or phd anything trash) to firstname lastname

now i am using regexp replace:

trim(regexp_replace(lower(vhc.name),'xx_|dr|\.|\,|phd|jr','')

but this is really really slow... can you give me some hint how can i replace this something faster? I have too much data to compare and do other functions on these data and it takes hours.

2
  • 1
    If you are comparing the expression, you need a function-based index. If you can tell us what exactly is the query and some sample data, someone can provide you a specific answer. Commented Oct 18, 2014 at 13:26
  • 1
    @Csanesz regexp have the reputation of being slow. Mostly because they require to be somehow compiled before processing. But once done, they are not that slow at all (esp. without loops and lookahead). Could you show your actual query? How many rows do you have? Any index on the relevant rows? Commented Oct 18, 2014 at 16:33

2 Answers 2

1

A reduced one.

trim(regexp_replace(lower(vhc.name),'xx_|[dj]r|[.,]|phd','')
Sign up to request clarification or add additional context in comments.

2 Comments

thx but i actually want to drop this regexp replace and something else if its exists.
@Csanesz the slowness could be with your query. regexp_replace is bit CPU intensive but not that slow. Can you share your query
0

Late response, but might help someone landing here just like me.

replace(table1.column_here, 'string_to_be_replaced', 'to_replace_with')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.