AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-9078

bmargulies's questions

Martin Hope
bmargulies
Asked: 2012-09-10 08:20:34 +0800 CST

postgres 9.1:md5 和 ident 在同一连接类型上?

  • 3

在 pg_hba.conf 中,有没有办法为本地连接启用“ident”和“md5”?

具体来说,我很高兴为人类打开“身份”以与数据库进行交互。但是,如果我设置一个 httpd 实例(例如),我不喜欢必须添加一个完整的 linux 用户以便它可以通过 ident 连接到数据库。我只想在 postgres 中分配一个密码。

我在 pg_hba.conf 中为“本地”设置两行的实验没有奏效,但该文档有点模棱两可,我想也许我错过了一些东西。

postgresql
  • 1 个回答
  • 353 Views
Martin Hope
bmargulies
Asked: 2012-06-06 10:36:15 +0800 CST

mongodb 在记录更新时告诉我什么?

  • 6

在将大量数据推送到 mongo 的大型程序运行几分钟后,我的日志开始显示(我猜)每次更新的消息。这似乎非常嘈杂,是否有一些特殊的原因它觉得有必要这样做?

Tue Jun  5 14:32:37 [conn3] update benchmark.entity  
 query: { corefEntityId: "45-LOCATION" } 
 update: { $set: { corefEntityId: "45-LOCATION", type: "Location" },
 $push: { indocs: { docid: "cfcc403b-714f-4c5d-8507-ccb5b6354654", 
   ordinal: 26, label: "United States", mentions: [ "United States" ] } }, 
   $addToSet: { allMentions: { $each: [ "United States" ] } }, 
   $inc: { documentCount: 1 } } 116ms

作为一个也许更容易回答的脚注,我想知道:是一个“upsert”,它添加到一些内部文档中比作为顶级文档简单地插入到内部文档的其他集合中更快或更慢?

mongodb upsert
  • 1 个回答
  • 1739 Views
Martin Hope
bmargulies
Asked: 2012-06-05 15:47:30 +0800 CST

加快 postgresql 中的删除

  • 3

我想出了:

drop table if exists idtemp;
create temp table idtemp as 
      select documentid from taskflag where taskid='coref' and state = 2 
         order by statechanged asc limit howmany;
create unique index on idtemp(documentid);

-- trim taskflag to the first N docs ordered by coref.
delete from taskflag where documentid not in (select documentid from idtemp) ;

当 taskflag 中有 120k 条记录并且我保留 10k 时,这非常慢。

任务标志看起来像:

\d taskflag
                Table "public.taskflag"
    Column    |            Type             | Modifiers 
--------------+-----------------------------+-----------
 documentid   | character varying(64)       | not null
 taskid       | character varying(64)       | not null
 state        | smallint                    | 
 statechanged | timestamp without time zone | 
Indexes:
    "taskflag_pkey" PRIMARY KEY, btree (documentid, taskid)
    "task_index2" btree (documentid)
    "task_index4" btree (taskid, state, statechanged)

解释说:

                                QUERY PLAN                                    
----------------------------------------------------------------------------------
 Delete on taskflag  (cost=0.00..105811822.25 rows=223210 width=6)
   ->  Seq Scan on taskflag  (cost=0.00..105811822.25 rows=223210 width=6)
         Filter: (NOT (SubPlan 1))
         SubPlan 1
           ->  Materialize  (cost=0.00..449.00 rows=10000 width=146)
                 ->  Seq Scan on idtemp  (cost=0.00..184.00 rows=10000 width=146)
(6 rows)

我应该只安排临时表来包含我保留的那些吗?

postgresql
  • 2 个回答
  • 1098 Views
Martin Hope
bmargulies
Asked: 2012-05-30 08:36:31 +0800 CST

如何在 pgsql 9.1 中执行返回 void 的过程?

  • 8

如果我使用 pgsql 命令在文件中执行以下命令,它会抱怨需要使用“执行”调用该过程。但是当我尝试使用 perform 时,它告诉我 perform 没有定义。解决方案是什么?

create or replace function waitris() returns void as 
$$
declare
    cnt integer;
begin
    loop
        select count(*) into cnt from taskflag where taskid = 'rdfdb' and state != 2;
        if cnt = 0 then   
            exit;
        end if;
        select pg_sleep(1);
    end loop;
end;
$$ 
language plpgsql;

select waitris();
postgresql
  • 1 个回答
  • 18478 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve