- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Interbase 是一个分代数据库。
这很好,因为回滚几乎是瞬时的,但是 count(*)
需要永远。
这是不像 例如MySQL where count 可以使用索引。
我一直不知道为什么,直到我看到这个:
Even when an index is available on the column or columns included in the COUNT, all records must be visited in order to see if they are visible under the current transaction isolation.
最佳答案
根据此链接:http://www.firebirdfaq.org/faq5/
There is another solution. This one is by Ivan Prenosil, a long time Interbase and Firebird hacker. This solution only returns an approximate record count. As Ann W. Harrison kindly explains: Any record that has had its primary key modified will appear twice if the old version has not been garbage collected and deleted records will continue in the count until they are garbage collected.
/* first update the statistics */
UPDATE RDB$INDICES SET RDB$STATISTICS = -1;
COMMIT;
/* Display table names and record counts */
SELECT RDB$RELATIONS.RDB$RELATION_NAME,
CASE
WHEN RDB$INDICES.RDB$STATISTICS = 0 THEN 0
ELSE CAST(1 / RDB$INDICES.RDB$STATISTICS AS INTEGER)
END
FROM RDB$RELATIONS
LEFT JOIN RDB$RELATION_CONSTRAINTS
ON RDB$RELATIONS.RDB$RELATION_NAME = RDB$RELATION_CONSTRAINTS.RDB$RELATION_NAME
AND RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
LEFT JOIN RDB$INDICES
ON RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME = RDB$INDICES.RDB$INDEX_NAME
WHERE RDB$VIEW_BLR IS NULL AND RDB$RELATION_ID >= 128
ORDER BY 1;This will only work on tables that have a primary key.
关于count - 如何加速 Interbase/Firebird 中的 Count(*),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5811747/
我有一个 Interbase 5.5 数据库(注意:这是一个非常旧的版本,来自上个千年)。 到目前为止,我已经成功使用 Delphi 附带的“ native ”Interbase 组件(IBDatab
我尝试关注http://edn.embarcadero.com/article/28604用于重新启动 Interbase。这是一些代码: program IBRestart; {$APPTYPE C
我们有一个数据库,我们的客户端是用Delphi 2007写的,用的是最新的Interbase 2009。数据库很旧,我相信它是在 2002 年左右创建的,现在已经超过 25 GB。最近发现在IBCon
如果将 Firebird 安装到已安装 Interbase 的系统上,是否会产生冲突。我看到有人提到使用相同的端口、路径添加以及 ISQL.exe 中的通用程序名称作为命令处理器。我看到引用 FB 版
(Interbase ToGo 是 InterBase sql 数据库的嵌入式版本。) 我正在通过从 Windows 7 应用程序访问它来对 InterBase ToGo 进行简单评估。但是,当我运行
我有一个来自 interbase7.1 的 .gdb 格式的备份文件。我在自己的机器上安装了interbase server,版本是xe7。我打开了 ibconsole.exe 应用程序。试图用上述备
我即将开始以适当的方式重做公司数据库。我们当前的数据库一团糟,几乎没有文档。我想知道人们在设计 Interbase 数据库时推荐使用什么?是否有某种好的视觉模式设计器可以生成 SQL?全部手工完成是否
作品 select payeeid, EXTRACT(WEEKDAY FROM checkdate) as DOW, (bankcleared - checkdate) as DateDiff fr
我的一位客户拥有一个不存在的旧应用程序;他与制作该应用程序的公司有问题,他们不会透露他的数据库密码。他意识到他签署了一份契约(Contract)(当时),其中说他是在“租用”该应用程序,他们无权透露任
我正在尝试使用 jdbc 连接到旧版 interbase 数据库,这是我的代码 try { Class.forName("interbase.interclient.Driver");
我让我的 RadStudio 设置正常工作,并为 android 创建了一个非常简单的移动应用程序,它使用 IBLite 来获取一些数据。出于商业原因,我不得不离开这个项目并转向其他事情。所以我回到
其实我的问题很简单:在 C# 中是否支持 Interbase 事件?在 Delphi 中有 TIBEvent 类,但我找不到用于 C# 的此类东西。 我唯一能想到的是直接使用 GDS32 dll 或自
我有一个遗留系统需要维护,在生产环境中这个系统运行正常,但在我的开发机器上我无法连接到数据库。我的操作系统是 Ubuntu 14.04,全新安装了 firebird2.5-classic,php 版本
我制作了一个在网络环境下访问 firebird 数据库的程序。 我通常在网络的两个不同点通过网络访问数据库。 但是如果我同时打开这两个程序,这个异常会在第二个程序上抛出,它试图连接到数据库: “您的用
我有以下问题 SELECT * FROM ( select distinct r1.rep_code,
我知道我可以在应用程序中使用 TIBEvents 对象来接收发布的事件 通过使用 POST_EVENT 的 Interbase 服务器。 通过在 IB 数据库上设置触发器,我可以使用这种机制来获取通知
这是我将用户添加到 Interbase 安全数据库的 Delphi 代码 uses IBHeader,IBExternals var Form7: TForm7; userData: TU
我有一个扩展名为 .ib 的文件。我猜测它是 Interbase 或 Firebird 文件,但我无法确定到底是哪个文件。此外,尚不清楚到底是使用 Interbase(或 Firebird)的哪个版本
Interbase 是一个分代数据库。 这很好,因为回滚几乎是瞬时的,但是 count(*)需要永远。 这是不像 例如MySQL where count 可以使用索引。 我一直不知道为什么,直到我看到
我正在尝试将 Interbase 连接池添加到 GlassFish v3 在项目中使用 EJB 3.1。 glassfish 日志似乎正确连接到我的数据库,它输出了我所有的表名和索引。但是,我收到错误
我是一名优秀的程序员,十分优秀!