海豚php超过百万数据分页列表卡死
海豚php超过百万数据分页列表卡死,原因是会去链表查询count(),这个语句很耗时,导致卡死 官方有好的解决方案吗?
thinkphp/library/think/db/Query.php:1339
问题定位:=9pt$total =9pt= =9pt$this=9pt->=9ptcount=9pt();
thinkphp/library/think/db/Query.php:1339
问题定位:=9pt$total =9pt= =9pt$this=9pt->=9ptcount=9pt();
<?php这里如果列表有链表查询且当数据量超过百万条后查询瞬间卡死!!
public function count($field = '*'){
if (isset($this->options['group'])) {
// 支持GROUP
$options = $this->getOptions();
$subSql = $this->options($options)->field('count(' . $field . ')')->bind($this->bind)->buildSql();
return $this->table([$subSql => '_group_count_'])->value('COUNT(*) AS tp_count', 0, true);
}
return $this->value('COUNT(' . $field . ') AS tp_count', 0, true);
}
?>
没有找到相关结果
已邀请:
1 个回复
mrcai - 海豚PHP资深开发
赞同来自: