Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/oscon_tsearch2/readme_overview_07.html
Дата изменения: Unknown Дата индексирования: Sat Dec 22 10:29:14 2007 Кодировка: Поисковые слова: ngc 5128 |
Previous | Next |
Tsearch2 README File Example: Overview (Continued)Create a gist index for the tsvector data type column, ts_vec. create index ts_readme_ts_vec_in on ts_readme using gist(ts_vec); VACUUM FULL ANALYZE; EXPLAIN ANAYLZE SELECT *, rank(ts_vec, to_tsquery('default', 'database | query')) FROM ts_readme WHERE ts_vec @@ to_tsquery('default', 'database | query') ORDER BY rank(ts_vec, to_tsquery('default', 'database | query')) DESC LIMIT 5; QUERY PLAN ------------------------------------------------------------------------------------------------- Limit (cost=2.39..2.39 rows=1 width=89) (actual time=0.290..0.305 rows=5 loops=1) -> Sort (cost=2.39..2.39 rows=1 width=89) (actual time=0.286..0.292 rows=5 loops=1) Sort Key: rank(ts_vec, '\'databas\' | \'queri\''::tsquery) -> Index Scan using ts_readme_ts_vec_in on ts_readme (cost=0.00..2.38 rows=1 width=89) (actual time=0.079..0.247 rows=11 loops=1) Index Cond: (ts_vec @@ '\'databas\' | \'queri\''::tsquery) Filter: (ts_vec @@ '\'databas\' | \'queri\''::tsquery) Total runtime: 0.412 ms (7 rows) |