Re: [GENERAL] Creation of tsearch2 index is very slow - Mailing list pgsql-performance

From Craig A. James
Subject Re: [GENERAL] Creation of tsearch2 index is very slow
Date
Msg-id 43D18EA9.8060409@modgraph-usa.com
Whole thread Raw
In response to Re: [GENERAL] Creation of tsearch2 index is very slow  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Tom Lane wrote:
> Well, we're trying to split an index page that's gotten full into two
> index pages, preferably with approximately equal numbers of items in
> each new page (this isn't a hard requirement though).  ...  If that's
> correct, what you really want is to divide the values so that the unions
> of the two sets have minimal overlap ... which seems to me to have
> little to do with what the code does at present.

This problem has been studied extensively by chemists, and they haven't found any easy solutions.

The Jarvis Patrick clustering algorithm might give you hints about a fast approach.  In theory it's K*O(N^2), but J-P
ispreferred for large datasets (millions of molecules) because the coefficient K can be made quite low.  It starts with
a"similarity metric" for two bit strings, the Tanimoto or Tversky coefficients: 

  http://www.daylight.com/dayhtml/doc/theory/theory.finger.html#RTFToC83

J-P Clustering is described here:

  http://www.daylight.com/dayhtml/doc/cluster/cluster.a.html#cl33

J-P Clustering is probably not the best for this problem (see the illustrations in the link above to see why), but the
generalidea of computing N-nearest-neighbors, followed by a partitioning step, could be what's needed. 

Craig

pgsql-performance by date:

Previous
From: "Steinar H. Gunderson"
Date:
Subject: Re: [GENERAL] Creation of tsearch2 index is very slow
Next
From: Rikard Pavelic
Date:
Subject: Re: [PERFORMANCE] Stored Procedures