log.txt

text/plain

Filename: log.txt
Type: text/plain
Part: 0
Message: faster ts_headline
$ psql -p 5454 postgres -c 'create table tmp(t text, hlt hltext);';
CREATE TABLE
$ bash -c 'echo "insert into tmp(t) values(\$CUTCUT\$" ; curl -d "" http://en.wikipedia.org/wiki/Michael_Jackson; echo "\$CUTCUT\$)"' | ./bin/psql -p 5454 postgres
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  636k  100  636k    0     0   224k      0  0:00:02  0:00:02 --:--:--  258k
INSERT 0 1
$ psql -p 5454 postgres
psql (9.0.5, server 9.3devel)
WARNING: psql version 9.0, server version 9.3.
         Some psql features might not work.
Type "help" for help.

postgres=# update tmp set hlt = to_hltext('english', t);
UPDATE 1
postgres=# \timing
Timing is on.
postgres=# select ts_headline('english', t, to_tsquery('janet & jackson'), 'MaxFragments=2 MinWords=5 MaxWords=15') from tmp;
                                                                                                             ts_headline                                                                                                             
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <b>Jackson</b>-Style. (video production; Michael and <b>Janet</b> <b>Jackson</b> video) .  29 . Theatre Crafts International ... Green Day Look Forward To <b>Janet</b> <b>Jackson</b>'s VMA Tribute To Michael" .  MTV . September
(1 row)

Time: 414,588 ms
postgres=# select ts_headline('english', t, to_tsquery('janet & jackson'), 'MaxFragments=2 MinWords=5 MaxWords=15') from tmp;
                                                                                                             ts_headline                                                                                                             
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <b>Jackson</b>-Style. (video production; Michael and <b>Janet</b> <b>Jackson</b> video) .  29 . Theatre Crafts International ... Green Day Look Forward To <b>Janet</b> <b>Jackson</b>'s VMA Tribute To Michael" .  MTV . September
(1 row)

Time: 75,912 ms
postgres=# select ts_headline('english', hlt, to_tsquery('janet & jackson'), 'MaxFragments=2 MinWords=5 MaxWords=15') from tmp;
                                                                                                             ts_headline                                                                                                             
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <b>Jackson</b>-Style. (video production; Michael and <b>Janet</b> <b>Jackson</b> video) .  29 . Theatre Crafts International ... Green Day Look Forward To <b>Janet</b> <b>Jackson</b>'s VMA Tribute To Michael" .  MTV . September
(1 row)

Time: 17,539 ms
postgres=# select ts_headline('english', hlt, to_tsquery('janet & jackson'), 'MaxFragments=2 MinWords=5 MaxWords=15') from tmp;
                                                                                                             ts_headline                                                                                                             
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <b>Jackson</b>-Style. (video production; Michael and <b>Janet</b> <b>Jackson</b> video) .  29 . Theatre Crafts International ... Green Day Look Forward To <b>Janet</b> <b>Jackson</b>'s VMA Tribute To Michael" .  MTV . September
(1 row)

Time: 15,526 ms
postgres=# select ts_headline('english', t, to_tsquery('janet & jackson'), 'MaxFragments=2 MinWords=5 MaxWords=15') from tmp;
                                                                                                             ts_headline                                                                                                             
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <b>Jackson</b>-Style. (video production; Michael and <b>Janet</b> <b>Jackson</b> video) .  29 . Theatre Crafts International ... Green Day Look Forward To <b>Janet</b> <b>Jackson</b>'s VMA Tribute To Michael" .  MTV . September
(1 row)

Time: 74,807 ms
postgres=#