在优化一条SQL的时候遇到了执行错误
gtlions=# select t1.telnumber,t2.ua,t2.url,t1.apply_name,t2.apply_name from tb1 t1
gtlions-# left outer join tb2 t2 on t1.sid = t2.ipsid
gtlions-# where t1.sum_date=20141128 and t1.sys_reported_time >= '2014-11-28 03:55:00' and t1.sys_reported_time <= '2014-11-28 04:00:00';
ERROR: could not create temporary file base/20350/pgsql_tmp/workfile_set_HashJoin_Slice0.XXXXva5ffL/spillfile_f261961:Too many open files
ERROR: could not seek in temporary file: Bad file descriptor
对应的SQLSTATE是58030,文档上是这样描述的
58030 IO ERROR io_error
检查了下打开文件数以及系统限制
[root@mdw ~]# lsof -n|wc -l 23583 [root@mdw ~]# ulimit -Hn 131072 [root@mdw ~]# ulimit -Sn 131072