pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
tsvector field length limitation
4+ messages / 3 participants
[nested] [flat]

* tsvector field length limitation
@ 2018-06-20 14:24  Jonathan Marks <jonathanaverymarks@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Jonathan Marks @ 2018-06-20 14:24 UTC (permalink / raw)
  To: pgsql-general

Hi folks —

We utilize Postgres’ full text search system pretty heavily in our team’s operations and often index tens of millions of records with varying lengths of text. In most cases, the text we need to index is pretty short (no more than. hundreds of words) but in rare cases a single record is very very long (high hundreds of thousands of words or longer). With those records, we run into the max tsvector length requirement "The length of a tsvector (lexemes + positions) must be less than 1 megabyte”

I understand the performance implications of having very long tsvectors (our gin index updates are pretty terrible in some cases) but would really appreciate it if the max tsvector length were larger (even 5MB would make a huge difference) or if that error were a stern warning rather than a hard error.

Is there any way to disable or increase that limit in Postgres 10.3? Perhaps in a future version?

Thank you!
Jonathan



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: tsvector field length limitation
@ 2018-06-20 14:49  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jonathan Marks <jonathanaverymarks@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2018-06-20 14:49 UTC (permalink / raw)
  To: Jonathan Marks <jonathanaverymarks@gmail.com>; +Cc: pgsql-general

Jonathan Marks <jonathanaverymarks@gmail.com> writes:
> ... we run into the max tsvector length requirement "The length of a tsvector (lexemes + positions) must be less than 1 megabyte”

> Is there any way to disable or increase that limit in Postgres 10.3?

No; it's forced by the representation used for tsvector, which stores
lexeme offsets in 20-bit fields (cf WordEntry in
src/include/tsearch/ts_type.h).  Perhaps that was short-sighted but
I don't foresee it changing anytime soon.  You'd more or less need
a whole new datatype ("bigtsvector"?) to make it happen.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: tsvector field length limitation
@ 2018-06-20 15:40  Jonathan Marks <jonathanaverymarks@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Jonathan Marks @ 2018-06-20 15:40 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general

What if we just didn’t use positional arguments at all? I.e. we just populate the tsvector with lexemes only?

> On Jun 20, 2018, at 10:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Jonathan Marks <jonathanaverymarks@gmail.com> writes:
>> ... we run into the max tsvector length requirement "The length of a tsvector (lexemes + positions) must be less than 1 megabyte”
> 
>> Is there any way to disable or increase that limit in Postgres 10.3?
> 
> No; it's forced by the representation used for tsvector, which stores
> lexeme offsets in 20-bit fields (cf WordEntry in
> src/include/tsearch/ts_type.h).  Perhaps that was short-sighted but
> I don't foresee it changing anytime soon.  You'd more or less need
> a whole new datatype ("bigtsvector"?) to make it happen.
> 
> 			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: tsvector field length limitation
@ 2019-02-11 09:10  AJG <ayden@gera.co.nz>
  parent: Jonathan Marks <jonathanaverymarks@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: AJG @ 2019-02-11 09:10 UTC (permalink / raw)
  To: pgsql-general

Hi Jonathan,

Check out this potential fix/extension

https://github.com/postgrespro/tsvector2





--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-02-11 09:10 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-20 14:24 tsvector field length limitation Jonathan Marks <jonathanaverymarks@gmail.com>
2018-06-20 14:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-06-20 15:40   ` Jonathan Marks <jonathanaverymarks@gmail.com>
2019-02-11 09:10     ` AJG <ayden@gera.co.nz>

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