小编Vas*_*sov的帖子

Postgres 慢查询(慢索引扫描)

我有一个包含 300 万行和 1.3GB 大小的表。在我的带有 4GB RAM 的笔记本电脑上运行 Postgres 9.3。

explain analyze
select act_owner_id from cnt_contacts where act_owner_id = 2
Run Code Online (Sandbox Code Playgroud)

我在 cnt_contacts.act_owner_id 上定义了 btree 键:

CREATE INDEX cnt_contacts_idx_act_owner_id 
   ON public.cnt_contacts USING btree (act_owner_id, status_id);
Run Code Online (Sandbox Code Playgroud)

查询在大约 5 秒内运行

cnt_contacts上的位图堆扫描(成本=2598.79..86290.73行=6208宽度=4)(实际时间=5865.617..5875.302行=5444循环=1)
  重新检查条件:(act_owner_id = 2)
  -> 位图索引扫描 cnt_contacts_idx_act_owner_id (cost=0.00..2597.24 rows=6208 width=0) (实际时间=5865.407..5865.407 rows=5444 loops=1)
        索引条件:(act_owner_id = 2)
总运行时间:5875.684 毫秒"
为什么需要这么长时间?

work_mem = 1024MB; 
shared_buffers = 128MB;
effective_cache_size = 1024MB
seq_page_cost = 1.0         # measured on an arbitrary scale
random_page_cost = 15.0         # same scale …
Run Code Online (Sandbox Code Playgroud)

sql postgresql postgresql-9.2

2
推荐指数
1
解决办法
6224
查看次数

Vue.js jQuery.focus 不起作用

jQuery $("#element").focus(); 函数第一次在 v-if div 中不起作用。

你好,我有 Vue js 的下一个问题。我有一个 div,它在加载时用 v-if 隐藏。当 v-if 条件为真时,显示 div 但该 div 内的输入字段不想聚焦。$("#element").focus();。这仅发生在第一次,在显示 div 之后 .focus() 工作

前任。我在方法中有这个功能

addBox: function (event)
{
    this.boxes.push({id: 1, name: 'Name', weight: 10 }); // Default is empty array. Comes true when i call this function and the div with #upc input becomes active and displayed
    $("#upc").focus(); // When the first time boxes becomes true $("#upc").focus(); does not work. Once is displayed it works after. 
}
Run Code Online (Sandbox Code Playgroud)

html

<div class="row" …
Run Code Online (Sandbox Code Playgroud)

vue.js

1
推荐指数
1
解决办法
1084
查看次数

标签 统计

postgresql ×1

postgresql-9.2 ×1

sql ×1

vue.js ×1