Comment 7 for bug 618356

Revision history for this message
Robert Collins (lifeless) wrote : Re: Person-picker takes a very long time consistently

explain analyze SELECT Person.id, rank(fti, ftq('david.wonderly'))
                   FROM Person
                   WHERE Person.fti @@ ftq('david.wonderly');
                                                QUERY PLAN
-----------------------------------------------------------------------------------------------------------
 Seq Scan on person (cost=0.00..44384.20 rows=5 width=54) (actual time=1123.050..1150.860 rows=1 loops=1)
   Filter: ((fti)::tsvector @@ '''david'' & ''wonder'' | ''davidwond'''::tsquery)
 Total runtime: 1150.917 ms

Indexes:
    "person_pkey" PRIMARY KEY, btree (id) CLUSTER
    "person__account__key" UNIQUE, btree (account)
    "person__name__key" UNIQUE, btree (name)
    "person__icon__idx" btree (icon) WHERE icon IS NOT NULL
    "person__logo__idx" btree (logo) WHERE logo IS NOT NULL
    "person__merged__idx" btree (merged) WHERE merged IS NOT NULL
    "person__mugshot__idx" btree (mugshot) WHERE mugshot IS NOT NULL
    "person__registrant__idx" btree (registrant)
    "person__teamowner__idx" btree (teamowner) WHERE teamowner IS NOT NULL
    "person_datecreated_idx" btree (datecreated)
    "person_sorting_idx" btree (person_sort_key(displayname, name))

There is no person fti index.

Either we need to add one, or drop the fti component of this query.