Thread: Getting "Out of memory" errors on server 9.1.9

Getting "Out of memory" errors on server 9.1.9

From
Brian Wong
Date:
I'm getting a "Out of memory" error on a 9.1.9 server.  What do these lines in the log mean?  ~ Brian

TopMemoryContext: 738160 total in 82 blocks; 11792 free (52 chunks); 726368 used
  Type information cache: 24576 total in 2 blocks; 11888 free (5 chunks); 12688 used
  Operator lookup cache: 24576 total in 2 blocks; 11888 free (5 chunks); 12688 used
  TopTransactionContext: 8192 total in 1 blocks; 7328 free (0 chunks); 864 used
  MessageContext: 3046113280 total in 374 blocks; 24584 free (5 chunks); 3046088696 used
  Operator class cache: 8192 total in 1 blocks; 1680 free (0 chunks); 6512 used
  smgr relation table: 24576 total in 2 blocks; 13920 free (4 chunks); 10656 used
  TransactionAbortContext: 32768 total in 1 blocks; 32736 free (0 chunks); 32 used
  Portal hash: 8192 total in 1 blocks; 1680 free (0 chunks); 6512 used
  PortalMemory: 8192 total in 1 blocks; 8160 free (1 chunks); 32 used
  Relcache by OID: 122880 total in 4 blocks; 13456 free (7 chunks); 109424 used
  CacheMemoryContext: 8682160 total in 24 blocks; 3426208 free (1 chunks); 5255952 used
    v_paths_netmedia: 3415040 total in 419 blocks; 14264 free (24 chunks); 3400776 used
    v_paths_shottree: 14818304 total in 1811 blocks; 26704 free (106 chunks); 14791600 used
    pg_toast_2618_index: 2048 total in 1 blocks; 664 free (0 chunks); 1384 used
    v_paths_limbo: 269312 total in 35 blocks; 2536 free (0 chunks); 266776 used
    v_paths: 31744 total in 6 blocks; 4568 free (0 chunks); 27176 used
    pg_db_role_setting_databaseid_rol_index: 2048 total in 1 blocks; 712 free (0 chunks); 1336 used
    pg_opclass_am_name_nsp_index: 3072 total in 2 blocks; 1496 free (2 chunks); 1576 used
    pg_foreign_data_wrapper_name_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_enum_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_class_relname_nsp_index: 3072 total in 2 blocks; 1656 free (3 chunks); 1416 used
    pg_foreign_server_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_statistic_relid_att_inh_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_cast_source_target_index: 3072 total in 2 blocks; 1656 free (3 chunks); 1416 used
    pg_language_name_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_collation_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_amop_fam_strat_index: 3072 total in 2 blocks; 1496 free (2 chunks); 1576 used
    pg_index_indexrelid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_ts_template_tmplname_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_ts_config_map_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_opclass_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_foreign_data_wrapper_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_ts_dict_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_conversion_default_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_operator_oprname_l_r_n_index: 3072 total in 2 blocks; 1496 free (2 chunks); 1576 used
    pg_trigger_tgrelid_tgname_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_enum_typid_label_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_ts_config_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_user_mapping_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_opfamily_am_name_nsp_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_foreign_table_relid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_type_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_aggregate_fnoid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_constraint_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_rewrite_rel_rulename_index: 3072 total in 2 blocks; 1656 free (3 chunks); 1416 used
    pg_ts_parser_prsname_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_ts_config_cfgname_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_ts_parser_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_operator_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_namespace_nspname_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_ts_template_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_amop_opr_fam_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_default_acl_role_nsp_obj_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_collation_name_enc_nsp_index: 3072 total in 2 blocks; 1544 free (2 chunks); 1528 used
    pg_ts_dict_dictname_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_type_typname_nsp_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_opfamily_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_class_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_proc_proname_args_nsp_index: 3072 total in 2 blocks; 1496 free (2 chunks); 1576 used
    pg_attribute_relid_attnum_index: 3072 total in 2 blocks; 1656 free (3 chunks); 1416 used
    pg_proc_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_language_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_namespace_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_amproc_fam_proc_index: 3072 total in 2 blocks; 1496 free (2 chunks); 1576 used
    pg_foreign_server_name_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_attribute_relid_attnam_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_conversion_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_user_mapping_user_server_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_conversion_name_nsp_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_authid_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_auth_members_member_role_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_tablespace_oid_index: 3072 total in 2 blocks; 1768 free (4 chunks); 1304 used
    pg_database_datname_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_auth_members_role_member_index: 3072 total in 2 blocks; 1704 free (4 chunks); 1368 used
    pg_database_oid_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
    pg_authid_rolname_index: 3072 total in 2 blocks; 1720 free (3 chunks); 1352 used
  MdSmgr: 8192 total in 1 blocks; 8128 free (0 chunks); 64 used
  LOCALLOCK hash: 516096 total in 6 blocks; 268800 free (21 chunks); 247296 used
  Timezones: 83472 total in 2 blocks; 3744 free (0 chunks); 79728 used
  ErrorContext: 8192 total in 1 blocks; 8160 free (4 chunks); 32 used
2013-08-22 08:01:15 PDT ERROR:  out of memory
2013-08-22 08:01:15 PDT DETAIL:  Failed on request of size 40.

Re: Getting "Out of memory" errors on server 9.1.9

From
Tom Lane
Date:
Brian Wong <bwong@imageworks.com> writes:
> I'm getting a "Out of memory" error on a 9.1.9 server.  What do these lines
> in the log mean?  ~ Brian

It's a memory usage map.  Your problem is evidently here:

>   MessageContext: 3046113280 total in 374 blocks; 24584 free (5 chunks);
> 3046088696 used

As far as I recall at the moment, MessageContext is used to parse,
analyze, and possibly to plan an incoming query.  So the short answer is
that you're trying to run a query that's too long and/or too complicated.
We'd need a lot more details before suggesting how you might work around
that.

            regards, tom lane