我有类似的问题:Python subprocess.Popen"OSError:[Errno 12]无法分配内存"
我有一个守护程序进程运行好几分钟然后无法通过运行shell程序popen2.Popen3().它产生20个线程.记忆似乎不是问题; 这是机器上运行的唯一程序,它有2G的RAM,而且使用的程序不到400M.我一直在记录ru_maxrss,这只是50M(在引发OSError之前和之后).
ulimit -a:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 15962
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes …Run Code Online (Sandbox Code Playgroud) sysdate和current_date的oracle文档声称它们都返回DATE:
但是这个测试:
alter session set plsql_warnings = 'ENABLE:ALL';
create table test(x date);
create or replace procedure test1 authid definer is
cursor s is select x from test where current_date > x;
begin for x in s loop null; end loop; end;
/
show errors
drop table test;
drop procedure test1;
Run Code Online (Sandbox Code Playgroud)
产生这个输出:
Errors for PROCEDURE TEST1:
LINE/COL ERROR
3/42 PLW-07204: conversion away from column type may result in sub-optimal query plan
Run Code Online (Sandbox Code Playgroud)
使用sysdate不会给出相同的警告.我怀疑在查询中用current_date替换sysdate会冒更改查询计划的风险,尤其是在索引日期列的情况下.
编辑:
select dump(current_date) from dual;
select dump(sysdate) …Run Code Online (Sandbox Code Playgroud) Oracle Database 11g 11.2.0.4.0版 - 64位生产
解决:是由基数反馈引起的.我以为我早些时候已经测试过它并将其消除,但显然是错了.
添加此查询:
select --+ opt_param('_optimizer_use_feedback' 'false')
Run Code Online (Sandbox Code Playgroud)
现在一直很快.
我有这种奇怪的情况,在前两次执行中查询似乎运行得相当快,然后在后续执行时慢得多.我使用带有"set autotrace on"的sqlplus来获取查询计划,并且对于每次运行,计划是相同的(相同的行估计等).最后的autotrace统计信息表明在后续执行中会读取更多数据.
如果我在语法上更改查询(只需添加或删除注释),那么它可能是SQL缓存的新内容,然后它会快速运行两次,然后再慢慢运行.如果我将其更改回我之前使用的查询版本(因此在缓存中),那么它总是很慢.
我不认为它与基数反馈有关,因为:
那我下一步该看哪儿?我可以用什么工具来缩小发生这种情况的原因?
这是我正在测试的查询:
set timing on
set autotrace on
select distinct
cc2.circuit_id as circuit_id
, cc2.circuit_component_id as component_circuit_id
from bsdb.bs_instance si
join bsdb.bs_location_schedule ls
on ls.bs_instance_id = si.id
and coalesce(ls.terminated_date, sysdate) >= sysdate
join npc.npc_customer_service cs
on cs.bs_location_schedule_id = ls.id
and cs.circuit_status_id in (1, 2, 6)
join tdb.loc_site_code lsc
on lsc.id = ls.site_code_id
left outer join scdb.brand br
on …Run Code Online (Sandbox Code Playgroud)