Re: [GENERAL] using text search

2013-04-23 Thread Rafał Pietrak
Ha! Got it! for enybody whois interested: with tst(regexp) as (SELECT '(' || array_to_string(array_agg(phrase), '|') || ')' from KEYWORDS) select o.* from ORDERS o, tst t where o.info ~ t.regexp; execution time: 6400ms. (keywords=4, orders=1mln) BTW: does anybody know if there is an index,

Re: [GENERAL] using text search

2013-04-23 Thread Alfonso Afonso
Hi Rafal This function returns the position where the substring is found, so you could do a query with clause position(table1.field in table2.field) The 0 result is not found and maybe, in your case, is faster the use of internal text functions instead of like comparison... hope helps. Bye El

Re: [GENERAL] using text search

2013-04-23 Thread Rafał Pietrak
W dniu 04/22/2013 08:43 PM, Alfonso Afonso pisze: I forgot to say that the function is "position ( txtseach in txtcomplete)" :) Bye Alfonso, thenx But if I may: How can I use that function? In a context of my problem? then again. At the edge of desperation, I'm thinking of writing a funct

Re: [GENERAL] using text search

2013-04-22 Thread Alfonso Afonso
I forgot to say that the function is "position ( txtseach in txtcomplete)" :) Bye El 22/04/2013, a las 19:36, Alfonso Afonso escribió: > And using substring function? Do you have the same results? > > I understand your arguments about normalization but, as you know, BNF is the > best SQL Deve

Re: [GENERAL] using text search

2013-04-22 Thread Alfonso Afonso
And using substring function? Do you have the same results? I understand your arguments about normalization but, as you know, BNF is the best SQL Developer friend ;) I used to avoid text fields and search/filter them (when it is possible), mainly because this consumption issues if the query

Re: [GENERAL] using text search

2013-04-22 Thread Rafał Pietrak
Hi, W dniu 04/22/2013 05:57 PM, Alfonso Afonso pisze: Hi Rafal Maybe you should think or consider to have normalized database to do this kind of select. I mean that if the keyword is a key you could add a column to table orders and have it ordered and indexed without having to reevaluate the

Re: [GENERAL] using text search

2013-04-22 Thread Alfonso Afonso
Hi Rafal Maybe you should think or consider to have normalized database to do this kind of select. I mean that if the keyword is a key you could add a column to table orders and have it ordered and indexed without having to reevaluate the query every time. About your question, if you are searc

[GENERAL] using text search

2013-04-22 Thread Rafał Pietrak
... or not (I'm not quite sure) Hello, I have the following tables: CREATE TABLE orders (info text, ); CREATE TABLE keywords (phrase text, .); And I need to find all the ORDERS rows, which conain a PHRASE present in the info column ... like so: SELECT o.* from orders o join keywords k