Unix Technical Forum

index row size exceeds btree maximum, 2713 - Solutions?

This is a discussion on index row size exceeds btree maximum, 2713 - Solutions? within the Pgsql General forums, part of the PostgreSQL category; --> I'm trying to load some data into PostgreSQL 8.0.3, and I got the error message "index row size 2904 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 05:01 AM
Dan Armbrust
 
Posts: n/a
Default index row size exceeds btree maximum, 2713 - Solutions?

I'm trying to load some data into PostgreSQL 8.0.3, and I got the error
message "index row size 2904 exceeds btree maximum, 2713". After a
bunch of searching, I believe that I am getting this error because a
value that I am indexing is longer than ~ 1/3 of the block size - or the
BLCKSZ variable in the src/include/pg_config_manual.h file.

Am I correct so far?

I need to fix this problem. I cannot change the indexed columns. I
cannot shorten the data value. And I cannot MD5 it, or any of those
hashing types of solutions that I saw a lot while searching.

Is there a variable I can set somewhere, so that postgresql would just
truncate the value to the max length that the index can handle when it
goes to enter it into the index, instead of failing with an error? I
would be fine with not having this particular row fully indexed, so long
as I could still retrieve the full data value.

The other solution that I saw was to modify the BLCKSZ variable. From
what I saw, it appears that to change that variable, I would need to
dump my databases out, recompile everything, and then reload them from
scratch. Is this correct?

Currently the BLCKSZ variable is set to 8192. What are the
performance/disk usage/other? implications of doubling this value, to 16384?

Any other suggestions in dealing with this problem?

Thanks,

Dan

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 05:01 AM
Bruno Wolff III
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

On Mon, Jul 18, 2005 at 14:44:26 -0500,
Dan Armbrust <daniel.armbrust.list@gmail.com> wrote:
> I'm trying to load some data into PostgreSQL 8.0.3, and I got the error
> message "index row size 2904 exceeds btree maximum, 2713". After a
> bunch of searching, I believe that I am getting this error because a
> value that I am indexing is longer than ~ 1/3 of the block size - or the
> BLCKSZ variable in the src/include/pg_config_manual.h file.
>
> Am I correct so far?
>
> I need to fix this problem. I cannot change the indexed columns. I
> cannot shorten the data value. And I cannot MD5 it, or any of those
> hashing types of solutions that I saw a lot while searching.


Can you explain how you are using the index now and what you are trying
to accomplish? It is hard to suggest alternatives without knowing what
you are really trying to do.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 05:01 AM
Jaime Casanova
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

> I'm trying to load some data into PostgreSQL 8.0.3, and I got the error
> message "index row size 2904 exceeds btree maximum, 2713". After a
> bunch of searching, I believe that I am getting this error because a
> value that I am indexing is longer than ~ 1/3 of the block size - or the
> BLCKSZ variable in the src/include/pg_config_manual.h file.
>
> Am I correct so far?
>
> I need to fix this problem. I cannot change the indexed columns.
>


can you drop the index and retry?
what typo is the column?



--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 05:01 AM
Jaime Casanova
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

> The index that is failing is CREATE INDEX i1 ON conceptproperty USING btree
> (codingschemename, property, propertyvalue).
>


I don't think you could create indexes on text fields... there are
other type of indexes for that... tsearch2 for example

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 05:01 AM
Tom Lane
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

Dan Armbrust <daniel.armbrust.list@gmail.com> writes:
> The index that is failing is CREATE INDEX i1 ON conceptproperty USING
> btree (codingschemename, property, propertyvalue).<br>
> <br>
> Usually, the 'propertyValue' field is fairly short - 100 chars or
> less.&nbsp; And in those cases, I need to be able to do an indexed search on
> it.


You do realize that the above index has nothing whatever to do with
searches on propertyvalue? (Or at least not propertyvalue alone.)

My advice is to drop propertyvalue from the index and see what
performance you get.

You could possibly do something with a partial index, eg
create index ... where length(propertyvalue) < 2000
but that'd probably require modifying your queries, so I suspect it's
not really very practical.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-09-2008, 05:01 AM
Scott Marlowe
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 -

On Mon, 2005-07-18 at 15:17, Dan Armbrust wrote:
> We have built a Model for terminologies that we call The Lexical Grid
> (more info http://informatics.mayo.edu/LexGrid/index.php)
>
> LexGrid has multiple backend data storage mechanisms, including LDAP
> and SQL. We do our best to remain implementation independent - our
> SQL implementations, for example can run against MS Access, DB2, MySQL
> and PostgreSQL.
>
> I'm currently trying to load a new terminology into a PosgreSQL
> backend, and arrived at this error because it happens to have a couple
> of very large data values that get mapped into the 'propertyvalue'
> field.


Well, if you're trying to maintain compatibility to multiple backends,
then requiring a non-standard block size is going to be a big
non-starter for most folks running postgresql. Very few, if any users,
are going to be willing to install a version of postgresql setup that
way just because of one program's needs.

Does this need to be a unique index for any reason? If so, then an
md5(propertyvalue) would give you that. If not, then you could make a
partial index like so:

create index yada_dx on yada (propertyvalue) where
length(propertybalue)<100;

But that would require you to add "where length(propertyvalue)<100" onto
your queries to use the index, I believe.

OTOH, this may be the time to use a hash index.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-09-2008, 05:01 AM
Scott Marlowe
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 -

On Mon, 2005-07-18 at 16:01, Dan Armbrust wrote:
> Hmm, well, I don't know if it is actually building an index properly
> on this column, I just assumed that it was. It doesn't fail on every
> insert, only on the one that has a really long text value. I know it
> doesn't use the index when I do "ILIKE" queries, resulting in poor
> performance... but I assumed that was because I was trying to do a
> case insensitve search on a case sensitive column index. I didn't
> want to go down the road of writing even more database implementation
> specific code. I will usually be using Lucene for the full text
> searches anyway.
>
> Where is the documentation on tsearch2? I haven't seen it mentioned
> anywhere except a couple of mailing list postings.
>
> All of my other limitations on changing things aside - given a query
> like this:
>
> Select * from conceptproperty where codingSchemeName='foo' AND
> property='anotherfoo' and propertyValue ILIKE 'valu%'


OK, how selective are each of these three fields? If codingSchemeName
isn't very selective, then you'll likely never win with an index. Put
the most selective item first, that way the database will have the
smallest set of data to have to play with to get the answer you asked
for.

Next, hash indexes might have been the answer, when I didn't know you
were using like. Hash indexes, at least on my 7.4 box, can't use like.

Ilike can't use indexes period, and it's better to create a functional
index:

create index indexname on table (lower(fieldname));

and then always search on lower(fieldname);

> What indexe(s) would be recommended?
>
> My current 3 column index (that works on other DB's) doesn't perform
> well due to case sensitivity issues, and now fails, due to data length
> issues.


The reason your three column index likely doesn't work well in
postgresql is that you probably don't have much selectivity in the first
column. I'm just guessing there aren't that many coding schemes, but
there probably are plenty of properties. So, setting up your index with
that value first, and in first in your where clause should help,
assuming it's more selective.

IF you build a testcase on propertvalue, and try ilike, you'll notice
that it, quite simply does NOT use indexes.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-09-2008, 05:01 AM
Tom Lane
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

Dan Armbrust <daniel.armbrust.list@gmail.com> writes:
> All of my other limitations on changing things aside - given a query
> like this:
>
> Select * from conceptproperty where codingSchemeName='foo' AND
> property='anotherfoo' and propertyValue ILIKE 'valu%'
>
> What indexe(s) would be recommended?


I'd index on codingSchemeName and property and not worry so much about
propertyValue. I rather doubt that that part of the query is adding a
performance-critical amount of selectivity --- and even if you could fit
propertyValue into the index, you'd have to jump through hoops to get a
case-insensitive search on it when the other columns are case-sensitive.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-09-2008, 05:01 AM
Joshua D. Drake
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

Dan Armbrust wrote:
> Hmm, well, I don't know if it is actually building an index properly on
> this column, I just assumed that it was. It doesn't fail on every
> insert, only on the one that has a really long text value. I know it
> doesn't use the index when I do "ILIKE" queries, resulting in poor
> performance... but I assumed that was because I was trying to do a case
> insensitve search on a case sensitive column index. I didn't want to go
> down the road of writing even more database implementation specific
> code. I will usually be using Lucene for the full text searches anyway.
>
> Where is the documentation on tsearch2? I haven't seen it mentioned
> anywhere except a couple of mailing list postings.
>


http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/

And a devx article here:

http://www.devx.com/opensource/Article/21674/0


> All of my other limitations on changing things aside - given a query
> like this:
>
> Select * from conceptproperty where codingSchemeName='foo' AND
> property='anotherfoo' and propertyValue ILIKE 'valu%'
>
> What indexe(s) would be recommended?


Why don't you do this:

Select * from conceptproperty where codingSchemeName='foo' AND
property='anotherfoo' and propertyValue ~ lower('valu');

and have an index:

create index lower_propertyvalue_idx on
conceptproperty(lower(propertyvalue));

and have a index:

(codingschemename,property)

I would also be curious to see an explain analyze.

Sincerely,

Joshua D. Drake



--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-09-2008, 05:01 AM
Dennis Bjorklund
 
Posts: n/a
Default Re: index row size exceeds btree maximum, 2713 - Solutions?

On Mon, 18 Jul 2005, Jaime Casanova wrote:

> I don't think you could create indexes on text fields... there are
> other type of indexes for that... tsearch2 for example


You can index text fields, but you can't insert values bigger then
BLOCKSIZE/3 when you have an index on that column.

--
/Dennis Björklund


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:46 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com