All,

While running a Select query we get the below error:

ERROR:  out of memory
DETAIL:  Failed on request of size 192.

Postgres Conf details:
shared_buffers = 256000
work_mem =150000
max_stack_depth = 16384
max_fsm_pages = 400000
version: 8.1.3

We are using 8gb of Primary memory for the server which is used as a
dedicated database machine.

The data log shows the below message after getting the Out of memory error.
Also attached the explain for the query. Can someone let us know , if have
some worng parameter setup or any solution to the problem?

Regards,
Nimesh.


TopMemoryContext: 57344 total in 6 blocks; 9504 free (12 chunks); 47840 used
TopTransactionContext: 8192 total in 1 blocks; 7856 free (0 chunks); 336
used
Type information cache: 8192 total in 1 blocks; 1864 free (0 chunks); 6328
used
Operator class cache: 8192 total in 1 blocks; 4936 free (0 chunks); 3256
used
MessageContext: 1040384 total in 7 blocks; 263096 free (4 chunks); 777288
used
JoinRelHashTable: 8192 total in 1 blocks; 3888 free (0 chunks); 4304 used
smgr relation table: 8192 total in 1 blocks; 1840 free (0 chunks); 6352 used
Portal hash: 8192 total in 1 blocks; 3912 free (0 chunks); 4280 used
PortalMemory: 8192 total in 1 blocks; 8040 free (0 chunks); 152 used
PortalHeapMemory: 1024 total in 1 blocks; 856 free (0 chunks); 168 used
ExecutorState: 122880 total in 4 blocks; 51840 free (6 chunks); 71040 used
HashTableContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
HashBatchContext: 2089044 total in 8 blocks; 573232 free (12 chunks);
1515812 used
HashTableContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
HashBatchContext: 2080768 total in 7 blocks; 749448 free (11 chunks);
1331320 used
HashTableContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
HashBatchContext: 245760 total in 4 blocks; 109112 free (4 chunks); 136648
used
HashTableContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
HashBatchContext: 1032192 total in 6 blocks; 504104 free (8 chunks); 528088
used
HashTableContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
HashBatchContext: 1032192 total in 6 blocks; 474456 free (8 chunks); 557736
used
HashTableContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
HashBatchContext: 2080768 total in 7 blocks; 783856 free (11 chunks);
1296912 used
ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
.
.
.

AggContext: 941613056 total in 129 blocks; 13984 free (154 chunks);
941599072 used
TupleHashTable: 113303576 total in 24 blocks; 1347032 free (74 chunks);
111956544 used
ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
ExprContext: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used
Relcache by OID: 8192 total in 1 blocks; 3376 free (0 chunks); 4816 used
CacheMemoryContext: 516096 total in 6 blocks; 12080 free (0 chunks); 504016
used
rg_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
rg_idx: 1024 total in 1 blocks; 256 free (0 chunks); 768 used
rg_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
rc_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_c_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_c_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_ch_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_ch_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_ch_cd: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_cm_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_c_m_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_s_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_p_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_p_cd_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_a_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_a_v_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_d_sqldt_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_da_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_nw_key_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_n_id_idx: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
r_m_network_date_idx: 1024 total in 1 blocks; 328 free (0 chunks); 696 used
pg_index_indrelid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_attrdef_adrelid_adnum_index: 1024 total in 1 blocks; 328 free (0 chunks);
696 used
pg_type_typname_nsp_index: 1024 total in 1 blocks; 328 free (0 chunks); 696
used
pg_type_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_trigger_tgrelid_tgname_index: 1024 total in 1 blocks; 328 free (0
chunks); 696 used
pg_statistic_relid_att_index: 1024 total in 1 blocks; 328 free (0 chunks);
696 used
pg_auth_members_member_role_index: 1024 total in 1 blocks; 328 free (0
chunks); 696 used
pg_auth_members_role_member_index: 1024 total in 1 blocks; 328 free (0
chunks); 696 used
pg_rewrite_rel_rulename_index: 1024 total in 1 blocks; 328 free (0 chunks);
696 used
pg_proc_proname_args_nsp_index: 1024 total in 1 blocks; 256 free (0 chunks);
768 used
pg_proc_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_operator_oprname_l_r_n_index: 1024 total in 1 blocks; 192 free (0
chunks); 832 used
pg_operator_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_opclass_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_opclass_am_name_nsp_index: 1024 total in 1 blocks; 256 free (0 chunks);
768 used
pg_namespace_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_namespace_nspname_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_language_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_language_name_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_inherits_relid_seqno_index: 1024 total in 1 blocks; 328 free (0 chunks);
696 used
pg_index_indexrelid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_authid_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_authid_rolname_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_database_datname_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_conversion_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
pg_conversion_name_nsp_index: 1024 total in 1 blocks; 328 free (0 chunks);
696 used
pg_conversion_default_index: 1024 total in 1 blocks; 192 free (0 chunks);
832 used
pg_class_relname_nsp_index: 1024 total in 1 blocks; 328 free (0 chunks); 696
used
pg_class_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used
pg_cast_source_target_index: 1024 total in 1 blocks; 328 free (0 chunks);
696 used
pg_attribute_relid_attnum_index: 1024 total in 1 blocks; 328 free (0
chunks); 696 used
pg_attribute_relid_attnam_index: 1024 total in 1 blocks; 328 free (0
chunks); 696 used
pg_amproc_opc_proc_index: 1024 total in 1 blocks; 256 free (0 chunks); 768
used
pg_amop_opr_opc_index: 1024 total in 1 blocks; 328 free (0 chunks); 696 used
pg_amop_opc_strat_index: 1024 total in 1 blocks; 256 free (0 chunks); 768
used
pg_aggregate_fnoid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632
used
MdSmgr: 8192 total in 1 blocks; 5584 free (0 chunks); 2608 used
LockTable (locallock hash): 8192 total in 1 blocks; 3912 free (0 chunks);
4280 used
Timezones: 47592 total in 2 blocks; 5968 free (0 chunks); 41624 used
ErrorContext: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used
2008-06-29 20:48:25 PDT [13980]: [5-1] ERROR:  out of memory
2008-06-29 20:48:25 PDT [13980]: [6-1] DETAIL:  Failed on request of size
192.
                                                                                
                QUERY PLAN                   
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 HashAggregate  (cost=2552680.87..2553501.76 rows=54726 width=135)
   ->  Hash Join  (cost=1008.35..2550628.65 rows=54726 width=135)
         Hash Cond: ("outer".s_key = "inner"."key")
         ->  Hash Join  (cost=803.07..2548507.96 rows=54726 width=108)
               Hash Cond: ("outer".cp_key = "inner"."key")
               ->  Hash Join  (cost=687.96..2547161.51 rows=54726 width=82)
                     Hash Cond: ("outer".ch_key = "inner"."key")
                     ->  Hash Join  (cost=601.21..2545843.43 rows=54726 
width=60)
                           Hash Cond: ("outer".cr_key = "inner"."key")
                           ->  Hash Join  (cost=265.72..2544002.98 rows=54726 
width=62)
                                 Hash Cond: ("outer".go_key = "inner"."key")
                                 ->  Hash Join  (cost=23.12..2541844.97 
rows=54726 width=62)
                                       Hash Cond: ("outer".adv_key = 
"inner"."key")
                                       ->  Nested Loop  (cost=0.00..2541000.08 
rows=54901 width=48)
                                             ->  Nested Loop  (cost=0.00..4.14 
rows=2 width=16)
                                                   ->  Seq Scan on r_n  
(cost=0.00..1.06 rows=1 width=4)
                                                         Filter: (id = 607)
                                                   ->  Index Scan using 
r_d_sqldt_idx on r_da  (cost=0.00..3.05 rows=2 width=12)
                                                         Index Cond: ((sqldate 
>= '2008-01-01 00:00:00'::timestamp without time zone) AND (sqldate <= 
'2008-01-31 00:00:00'::timestamp without time zone))
                                             ->  Index Scan using 
r_m_nw_date_idx on r_m  (cost=0.00..1259386.12 rows=740790 width=48)
                                                   Index Cond: ((r_m.nw_key = 
"outer"."key") AND (r_m.date_key = "outer"."key"))
                                       ->  Hash  (cost=20.77..20.77 rows=939 
width=22)
                                             ->  Seq Scan on r_adv  
(cost=0.00..20.77 rows=939 width=22)
                                                   Filter: ((name)::text <> 
'SYSTEM'::text)
                                 ->  Hash  (cost=218.28..218.28 rows=9728 
width=8)
                                       ->  Seq Scan on rg  (cost=0.00..218.28 
rows=9728 width=8)
                           ->  Hash  (cost=302.39..302.39 rows=13239 width=6)
                                 ->  Seq Scan on rc  (cost=0.00..302.39 
rows=13239 width=6)
                     ->  Hash  (cost=77.20..77.20 rows=3820 width=30)
                           ->  Seq Scan on r_c  (cost=0.00..77.20 rows=3820 
width=30)
               ->  Hash  (cost=104.89..104.89 rows=4089 width=34)
                     ->  Seq Scan on r_cm  (cost=0.00..104.89 rows=4089 
width=34)
         ->  Hash  (cost=181.42..181.42 rows=9542 width=35)
               ->  Seq Scan on r_s  (cost=0.00..181.42 rows=9542 width=35)
(34 rows)
-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to