SELECT name, word_similarity('trade center new york mariott', name) AS sml from hotels_hotel where 'trade center new york mariott' %> name ORDER BY sml DESC LIMIT 5;
name | sml
----------------------------------------------------------------------------------------+------------
Courtyard by Marriott New York Downtown Manhattan/World Trade Center Area | 0.53846157
Fairfield Inn & Suites by Marriott New York Downtown Manhattan/World Trade Center Area | 0.53846157
Residence Inn by Marriott New York Downtown Manhattan/World Trade Center Area | 0.53846157
AC Hotel by Marriott New York Times Square | 0.53125
Courtyard by Marriott World Trade Center, Abu Dhabi | 0.5263158
(5 rows)
Time: 121519602.654969 ms (00:1209.152603)
EXPLAIN (ANALYZE, BUFFERS, VERBOSE, COSTS) SELECT name, word_similarity('trade center new york mariott', name) AS sml from hotels_hotel where 'trade center new york mariott' %> name ORDER BY sml DESC LIMIT 5;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=502890cost=65390.0353..50289065391.6111 rows=5 width=27) (actual time=11119time=9619.666113..111269625.331482 rows=5 loops=1)
Output: name, (word_similarity('trade center new york mariott'::text, (name)::text))
Buffers: shared hit=1746167
-> Gather Merge (cost=502890cost=65390.0353..50308865589.6111 rows=1702 width=27) (actual time=11063time=9619.630109..110709625.293474 rows=5 loops=1)
Output: name, (word_similarity('trade center new york mariott'::text, (name)::text))
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=1746167
-> Sort (cost=501890cost=64390.0150..50189264392.1363 rows=851 width=27) (actual time=11006time=9612.845578..110069612.846580 rows=4 loops=3)
Output: name, (word_similarity('trade center new york mariott'::text, (name)::text))
Sort Key: (word_similarity('trade center new york mariott'::text, (hotels_hotel.name)::text)) DESC
Sort Method: top-N heapsort Memory: 25kB
Worker 0: Sort Method: top-N heapsort Memory: 25kB
Worker 1: Sort Method: top-N heapsort Memory: 25kB
Buffers: shared hit=1746167
Worker 0: actual time=9610.098..9610.100 rows=5 loops=1
Buffers: shared hit=581861
Worker 1: actual time=9609.314..9609.317 rows=5 loops=1
Buffers: shared hit=579828
-> Parallel SeqIndex Only Scan using hotels_hotel_name_a9005e17 on public.hotels_hotel (cost=0.0043..50187564376.8737 rows=851 width=27) (actual time=82time=4.805040..109969606.658166 rows=15070 loops=3)
Output: name, word_similarity('trade center new york mariott'::text, (name)::text)
Filter: ('trade center new york mariott'::text %> (hotels_hotel.name)::text)
Rows Removed by Filter: 666002
Planning Time: 0.921 ms
JIT Heap Fetches: 2
Functions Buffers: 13shared hit=1746113
Options Worker 0: Inliningactual true,time=0.281..9603.591 Optimizationrows=14890 true,loops=1
Expressions true, Deforming true Buffers: shared hit=581834
Timing Worker 1: Generationactual 3time=8.177157..9602.811 ms,rows=14678 Inliningloops=1
185.660 ms, Optimization 72.270 ms, Emission 42.028 ms, Total 303 Buffers: shared hit=579801
Planning Time: 0.134396 ms
Execution Time: 111289625.345576 ms
(1831 rows)
Time: 9626.933
ms (00:09.627)