代码不适用于聚集索引

发布于 2024-08-06 09:00:50 字数 171 浏览 7 评论 0原文

我有一个应用程序,其中的指令表明它不适用于具有多个字段的聚集索引。 无法抗拒测试,这是真的。如果我添加包含 2 个字段的聚集索引,应用程序会陷入无尽的困境。

我认为索引是数据库内部的东西,不会影响应用程序。如何编写在聚集索引的情况下不起作用的sql?

该应用程序使用sql server 2005

I have an application where the instruction says that it doesn't work with clustered index with more than one field.
Couldn't resist testing and it is true. The app gets stuck in some endless lopp if i add a clustered index with 2 fields.

I thought the index was something internal to the database that doesn't affect the application. How do you write sql that doesn't work in the presense of a clustered index?

The app is using sql server 2005

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最偏执的依靠 2024-08-13 09:00:50

您制作的复合索引是聚集索引还是主键?有时,它们在 SQL Server 中被视为同义词,即使一个是域关系(主键),另一个(聚集索引)是实现细节。

某些 ORM 不能很好地处理复合主键。

数据库是否启用了定期维护计划?您是否手动运行DBCC CHECKDB

Was it the clustered index or the primary key that you made composite? These are sometimes treated as synonomous in SQL Server, even though one is a Domain relationship (the primary key) and the other (the clustered index) is an implementation detail.

Some ORMs don't work well with composite primary keys.

Does the database have a regularly scheduled maintenance plan enabled? Have you manually run DBCC CHECKDB?

别理我 2024-08-13 09:00:50

这可能表明应用程序使用有关表上索引的元数据来动态创建代码 - 例如,我的审核触发器生成脚本需要单列主键。但这当然与聚集索引不同。

它可能不值得进一步调查,因为无论这是什么应用程序,它都是记录在案的限制,但如果您需要对其进行逆向工程,您可以使用探查器来查看此循环中发生的情况。

This probably indicates that the application uses metadata about the indexes on a table to create code dynamically - for instance an audit trigger generation script I have requires a single-column primary key. But that's a different from a clustered index, of course.

It's probably not worth investigating further since it's a documented limit in whatever app this is, but if you need to reverse-engineer this, you can use the profiler to see what's going on in this loop.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文