- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 RedBeanPHP 连接到 Postgres 数据库,但我遇到了其他简单查询的缓慢查询时间。这似乎与 RedBean 的 exportAll()
有关。我正在访问类似于 RedBean 的示例:
$books = R::findAll( 'book' );
$beans= R::exportAll( $books );
直接使用查询:
$rows = R::getAll($sql);
$books = R::convertToBeans('books', $rows);
$beans= R::exportAll( $books );
这个查询在一个只有 66 个表的表上花费大约 1.25 秒,有两个映射表(在 RedBean 中链接)。这个查询时间看起来很慢并且与 R::exportAll() 直接相关。
版本:
有什么建议吗?
最佳答案
经过大量研究后,我在 'duplicate' section of the RedBeanPHP website 中找到了一个简介描述以下内容:
Both dup() and exportAll() need to query the database schema which is slow. To speed up the process you can pass a database schema:
R::$duplicationManager->setTables( $schema ); To obtain the schema use:
$schema = R::$duplicationManager->getSchema(); You can now use this schema to feed it to setTables(). R::duplicate() andR::exportAll() both use this schema.
这正是我所经历的,但我无法访问 R::$duplicationManager->getSchema()
,因为 $duplicationManager 现在是私有(private)变量 ( Found here in the API )。
幸运的是,API 文档中有一个“getDuplicationManager()”函数,因此非常成功:
$schema = R::getDuplicationManager()->getSchema();
R::getDuplicationManager()->setTables($schema);
这使我的时间减少到大约 0.14 秒,这更合理。
关于php - RedBeanPHP 慢 R::exportAll(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42633372/
我正在使用下表: CREATE TABLE `page` ( `id` int(11) unsigned NOT NULL, `revision` float unsigned NOT NUL
我的数据库中有一个用户列表,例如有名字、姓氏和公司,它们都是文本字段。现在我有一个自动完成字段,可以在其中输入名字、姓氏和公司来查找具有相似姓名或公司名称的用户。我想用 RedbeanPHP 来完成这
我一直在测试 RedBeanPHP . 我想知道如何清理用户输入。我是否需要手动清理数据或 RedBeanPHP 会处理这些? 最佳答案 RedBeanPHP 使用 PDO 绑定(bind)来防止 S
我在我的 php 项目中使用 Redbeanphp ( http://redbeanphp.com/ )。我想为我的表使用表前缀。 Redbeanphp 从 3.0 版本开始不支持表前缀。但我想扩展
我有一个$mycontacts 数组,其中包含$contact 类型的bean 地点: $contact->id = $x $contact->name = $y $contact->email= $
我无法让 findAll 函数返回比结果查询的最后一行更多的内容。我在 PHP 脚本上设置了 R::debug( TRUE ),它清楚地表明返回的数据结果集中有 4 个结果。当我将查询直接输入 MyS
此代码的 RedBeansPHP 等效项是什么? $sql = "SELECT * FROM user"; $result = $conn->query($sql); if ($result->num
我希望有一个示例,说明如何在不遍历每个实例的情况下在 readbeanphp 中批量插入新“bean”。 它在此处显示了创建和保存 bean 的示例:http://redbeanphp.com/man
我最近开始使用它,但不喜欢我的使用方式。想要的建议... 我正在使用类似的例子: $all = R::findAll('针', '按标题排序 LIMIT 2 '); 最佳答案 我认为建议的解决方案是好
我正在尝试使用 RedBeanPHP 保存一些简单的 PHP 对象。它工作正常,除了在字符串字段上,它到达一个有重音元音的点,即 á 或 'í' 并且只是跳过字符串中的其余字符。 例子: // Act
我真的很喜欢 RedBeanPHP 的概念。在开发中不必担心使用数据库,RedBean 会为您完成所有工作。表格在您工作时自行形成,当您对表格感到满意时,您会卡住它们。我看到的唯一问题是当您将项目移至
我想检索链接表的一些记录: table "portfolio" : -id -title table "portfolio_img" : -id -image -id_portfolio {id_po
我将 RedBean PHP ORM 1.2 与 Zend 和 Mysql 一起用于一个新项目。我仍在学习它,它在许多情况下都非常有效,除了我找不到如何加载与外键相关的 bean。请允许我解释一下。
我正在使用最新版本的 RedBeanPHP。我正在对足球比赛结构进行建模。一场比赛由 2 支球队进行,属于一个比赛日(数据库中的赛程)。 $o = R::dispense('game'); $o->l
我正在使用 RedBeanPHP 连接到 Postgres 数据库,但我遇到了其他简单查询的缓慢查询时间。这似乎与 RedBean 的 exportAll() 有关。我正在访问类似于 RedBean
我试图使用 redbeansphp 执行以下代码(在 php pdo 的顶部工作)。问题是,当我以类似“id;DROP TABLE users;”的格式传递有效 ID 时。 ,如果 id 与数据库中的
我在使用 Redbean PHP 查询单个字段中包含 json 对象数组的表并生成报告时遇到了问题。 我想要一份报告,其中包含所有员工的小计以及按类别分类的注释。我知道这应该很容易/显而易见,但我只是
我正在尝试使用 RedBean 从表中获取随机行。我试过这个: $amount = R::count($names); $id = rand(0, $amount); $randomname = R:
我有两个 MySQL 表“专家”(id、名称)和“语言”(id、标题)。在我的网站上,我可以提供专家姓名并发送到数据库(没有问题)。 $expert = R::dispense('experts');
我是 yii 框架和 redbeanphp 的新手。我想使用 yii 框架和 redbeanphp 启动一个新的网站应用程序。 如何使用 yii 框架对用户输入表单进行采样并使用 redbeanphp
我是一名优秀的程序员,十分优秀!