Indexing error when sending large payload content beyond Postgres Include design
DB VERSION: PGSQL 13
index row size 2744 exceeds btree version 4 maximum 2704 for index "idx_received_Version_ExpiresAt_StatusName"
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource
received表大约有140w条数据
CREATE INDEX IF NOT EXISTS "idx_received_Version_ExpiresAt_StatusName" ON "rfr_cap"."received" ("Version","ExpiresAt","StatusName") INCLUDE ("Id", "Content", "Retries", "Added")。
这是启动cap创建索引的语句,此时已经报错。
see https://www.google.com/search?q=index+row+size+2744+exceeds+btree+version+4+maximum
INCLUDE Content,把消息内容都构建到索引里面,虽然能有效提升查询,但content难以预料。或者索引创建参考这个?https://github.com/orgs/supabase/discussions/14898
@yyylly @yang-xiaodong
We're also experiencing this issue, and it looks like it's caused by the Content being too long. I also checked the historical version of CAP this is the first time the index has been added, is it overly complicated? Is it possible to tweak the index to get around this issue.
For your use case where the Content field needs to exceed the 2704-byte limit, I’m curious why you wouldn’t simply edit the index to remove the Content field from the INCLUDE clause. Leaving a comment here doesn’t solve the problem.
@yang-xiaodong
Of course we can modify this index, I would say that since more than one person is experiencing the same problem as me, have you thought about tweaking the index, if there is a performance issue previous versions did not have any indexes why insist on adding such a complex index? Have you considered removing the Content field from the default index? As a CAP user, since the CAP document itself does not contain a length limit for Content, why not adjust the index?
附议。建议直接移除,避免其他用户重复发生此类问题,然后还需手动处理。
@yang-xiaodong What one are you not willing to adjust this stupid and harmful Index?
Hi all I have the same Problem. I simply deleted the indexes and all works. But you should really provide a solution without a need to do that. Why include a Content!! Row in an complex index?? Sorry guys but this will quick go over. Depending how much content i want deliver. If this is really needed, then you shoould also not allow to put more conent in the field and send already at sending a apropriate message. But then CAP get uslsess for bigger data packages. So please provide a fix.
Hi all I have the same Problem. I simply deleted the indexes and all works. But you should really provide a solution without a need to do that. Why include a Content!! Row in an complex index?? Sorry guys but this will quick go over. Depending how much content i want deliver. If this is really needed, then you shoould also not allow to put more conent in the field and send already at sending a apropriate message. But then CAP get uslsess for bigger data packages. So please provide a fix.
Adding Content to the index isn't necessary, the current code doesn't add Content to the index in older versions of postgres, but it seems like the developers are not willing to fix this issue.
Fixed in version 8.3.3-preview-255432523
It's really unfortunate that such breaking changes occur, leaving the only solution as manually connecting to the database and modifying/removing internal indexes. I hope that in the future, such changes will be made configurable or at least better communicated in the release notes.
Additionally, if there is a new requirement for maximum content length, it should be enforced at the .NET level. Perhaps a new type for content? Or another solution that doesn't break existing applications with a feature that is impossible to unit test.
Thank you for your work.