pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mitch Vincent <mitch@venux.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Full text indexing (and errors!)
Date: Sun, 21 May 2000 14:28:35 -0400
Message-ID: <10020.958933715@sss.pgh.pa.us> (raw)
In-Reply-To: <001c01bfc350$d6d8ddc0$0300000a@doot.org>
References: <00db01bfc345$e5400100$0300000a@doot.org>
	<9916.958931894@sss.pgh.pa.us>
	<001c01bfc350$d6d8ddc0$0300000a@doot.org>

"Mitch Vincent" <mitch@venux.net> writes:
>> is there an index on applicants' OID column?

> No, there is not an index on the applicant OID column.. Since I'm getting
> all the records from the applicants table where the string I search for is
> in the resumes_fti table, I didn't think and index like that would help
> (since I'm qualifying the results based on rows in another table). Am I
> wrong in thinking that?

If the pattern match is reasonably selective then I'd think that the
best plan would probably be an indexscan on resumes_fti (using the
pattern operator to select rows) and then a nestloop join against the
applicant table using an inner indexscan on OID.  In English: look up
the entries in resumes_fti that match the pattern, and then use the OIDs
to look up the applicants entries ;-).  But it doesn't work without the
index on OID.

> select count(app_id) from applicants_resumes;
>  14673
> select count(id) from resumes_fti;
>  33462249

Hmm.  So the selectivity being estimated for the pattern match is
168041/33462249 or about 0.005 ... which is not huge but we'd
probably like it to be smaller.  What do you get from the standard
statistical query:

select attname,attdisbursion,s.*
from pg_statistic s, pg_attribute a, pg_class c
where starelid = c.oid and attrelid = c.oid and staattnum = attnum
and relname = 'resumes_fti';

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <10020.958933715@sss.pgh.pa.us>
Permalink:  ../10020.958933715@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10020.958933715@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mitch@venux.net
  Subject: Re: Full text indexing (and errors!)
  In-Reply-To: <10020.958933715@sss.pgh.pa.us>
  References: <00db01bfc345$e5400100$0300000a@doot.org> <9916.958931894@sss.pgh.pa.us> <001c01bfc350$d6d8ddc0$0300000a@doot.org> <10020.958933715@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox