Out of memory (Failed on request of size 212).

From: "Ricardo Arcos" <rarcos(at)gmail(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Out of memory (Failed on request of size 212).
Date: 2007-08-03 22:58:11
Message-ID: 42810b750708031558s57142d3fl384c28705e4482ef@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola, he estado durante varias horas tratando de entender y resolver
este problema, pero no he encontrado solución. He intentado cambiando
los parámetros de uso de memoria y recreando los índices de la tabla
involucrada en la consulta (he visto en otras listas de correo que la
corrupción en los datos puede provocar errores como este).

El servidor tiene un CPU Xeon 5510, 4 GB de RAM y un disco SCSI de 300
GB y 10000 RPM. Está corriendo PostgreSQL 8.1.3.

La consulta es la siguiente:

CREATE TABLE
"Bryc_TMP_BDM"."SP_P_VentasFactLI5_tmpPeriodo_4" AS
SELECT
T1.cli_id,
4 as peri_id,
T1.cat_id,
T1.sucu_id,
NULL::real as monto_agregacion,
NULL::bigint as monto_mes,
SUM(T1.monto_total) as monto_acumulado,
NULL::real as monto_acumulado_enero,
NULL::bigint as costo_mes,
SUM(T1.costo_total) as costo_acumulado,
NULL::real as costo_acumulado_enero,
NULL::bigint as contribucion_mes,
SUM(T1.contribucion_total) as contribucion_acumulado,
NULL::real as contribucion_acumulado_enero,
NULL::bigint as dias_compra_agregacion,
NULL::bigint as dias_compra_mes,
SUM(T1.dias_compra_mes) as dias_compra_acumulado,
NULL::bigint as dias_compra_acumulado_enero,
NULL::date as ultima_compra,
NULL::date as primera_compra
FROM
"Bryc_TMP_BDM"."FP_VentasFactLI5" T1
WHERE
T1.peri_id BETWEEN 1 AND 4
GROUP BY
T1.cli_id, T1.cat_id, T1.sucu_id

Cabe notar que la misma consulta la he realizado exitosamente con los filtros:

T1.peri_id BETWEEN 1 AND 1 (2800000 filas aprox.)
T1.peri_id BETWEEN 1 AND 2 (5700000 filas aprox.)
T1.peri_id BETWEEN 1 AND 3 (8900000 filas aprox.)

Para el filtro que deseo usar y que da errores, serian unas 11500000
filas aproximadamente.

Este es el explain:
QUERY PLAN
---------------------------------------------------------------------------------------------------
HashAggregate (cost=360871.96..361019.78 rows=7391 width=56)
-> Bitmap Heap Scan on "FP_VentasFactLI5" t1
(cost=178416.18..359578.66 rows=73903 width=56)
Recheck Cond: ((peri_id >= 1) AND (peri_id <= 4))
-> Bitmap Index Scan on "FP_VentasFactLI5_PK"
(cost=0.00..178416.18 rows=73903 width=0)
Index Cond: ((peri_id >= 1) AND (peri_id <= 4))

Este es el log del servidor:

TopMemoryContext: 40960 total in 4 blocks; 8648 free (9 chunks); 32312 used
TopTransactionContext: 24576 total in 2 blocks; 15944 free (2 chunks); 8632 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: 57344 total in 3 blocks; 24152 free (3 chunks); 33192 used
smgr relation table: 8192 total in 1 blocks; 2872 free (0 chunks); 5320 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; 896 free (0 chunks); 128 used
ExecutorState: 1151492 total in 4 blocks; 30232 free (20 chunks); 1121260 used
TIDBitmap: 25157632 total in 12 blocks; 6471200 free (37 chunks); 18686432 used
ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used
AggContext: -1738547200 total in 322 blocks; 27768 free (313 chunks);
-1738574968 used
TupleHashTable: 486662168 total in 68 blocks; 1281968 free (203
chunks); 485380200 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; 132544 free (11 chunks);
383552 used
pg_toast_35667_index: 1024 total in 1 blocks; 328 free (0 chunks); 696 used
FP_VentasFactLI5_cli_cat_sucu: 1024 total in 1 blocks; 256 free (0
chunks); 768 used
FP_VentasFactLI5_PK: 1024 total in 1 blocks; 192 free (0 chunks); 832 used
pg_shdepend_depender_index: 1024 total in 1 blocks; 256 free (0
chunks); 768 used
pg_shdepend_reference_index: 1024 total in 1 blocks; 328 free (0
chunks); 696 used
pg_depend_depender_index: 1024 total in 1 blocks; 256 free (0 chunks); 768 used
pg_depend_reference_index: 1024 total in 1 blocks; 256 free (0 chunks); 768 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; 6928 free (2 chunks); 1264 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
ERROR: out of memory
DETAIL: Failed on request of size 212.

Estas son las variables del servidor:

add_missing_from off
archive_command unset
australian_timezones off
authentication_timeout 60
autovacuum off
autovacuum_analyze_scale_factor 0.2
autovacuum_analyze_threshold 500
autovacuum_naptime 60
autovacuum_vacuum_cost_delay -1
autovacuum_vacuum_cost_limit -1
autovacuum_vacuum_scale_factor 0.4
autovacuum_vacuum_threshold 1000
bgwriter_all_maxpages 5
bgwriter_all_percent 0.333
bgwriter_delay 200
bgwriter_lru_maxpages 5
bgwriter_lru_percent 1
block_size 8192
bonjour_name unset
check_function_bodies on
checkpoint_segments 3
checkpoint_timeout 300
checkpoint_warning 30
client_encoding UTF8
client_min_messages notice
commit_delay 0
commit_siblings 5
config_file /bgdata/postgresql.conf
constraint_exclusion off
cpu_index_tuple_cost 0.001
cpu_operator_cost 0.0025
cpu_tuple_cost 0.01
custom_variable_classes unset
data_directory /bgdata
DateStyle ISO, MDY
db_user_namespace off
deadlock_timeout 1000
debug_pretty_print off
debug_print_parse off
debug_print_plan off
debug_print_rewritten off
default_statistics_target 10
default_tablespace unset
default_transaction_isolation read committed
default_transaction_read_only off
default_with_oids off
dynamic_library_path $libdir
effective_cache_size 1000
enable_bitmapscan on
enable_hashagg on
enable_hashjoin on
enable_indexscan on
enable_mergejoin on
enable_nestloop on
enable_seqscan on
enable_sort on
enable_tidscan on
escape_string_warning off
explain_pretty_print on
external_pid_file unset
extra_float_digits 0
from_collapse_limit 8
fsync on
full_page_writes on
geqo on
geqo_effort 5
geqo_generations 0
geqo_pool_size 0
geqo_selection_bias 2
geqo_threshold 12
hba_file /bgdata/pg_hba.conf
ident_file /bgdata/pg_ident.conf
integer_datetimes on
join_collapse_limit 8
krb_caseins_users off
krb_server_hostname unset
krb_server_keyfile unset
krb_srvname postgres
lc_collate C
lc_ctype C
lc_messages C
lc_monetary C
lc_numeric C
lc_time C
listen_addresses *
log_connections off
log_destination stderr
log_directory pg_log
log_disconnections off
log_duration off
log_error_verbosity default
log_executor_stats off
log_filename postgresql-%Y-%m-%d_%H%M%S.log
log_hostname off
log_line_prefix unset
log_min_duration_statement -1
log_min_error_statement panic
log_min_messages notice
log_parser_stats off
log_planner_stats off
log_rotation_age 1440
log_rotation_size 10240
log_statement none
log_statement_stats off
log_truncate_on_rotation off
maintenance_work_mem 16384
max_connections 100
max_files_per_process 1000
max_fsm_pages 20000
max_fsm_relations 1000
max_function_args 100
max_identifier_length 63
max_index_keys 32
max_locks_per_transaction 64
max_prepared_transactions 5
max_stack_depth 2048
password_encryption on
port 5432
pre_auth_delay 0
preload_libraries unset
random_page_cost 4
redirect_stderr off
regex_flavor advanced
search_path $user,public
server_encoding UTF8
server_version 8.1.3
shared_buffers 16000
silent_mode off
sql_inheritance on
ssl off
standard_conforming_strings off
statement_timeout 0
stats_block_level off
stats_command_string on
stats_reset_on_server_start off
stats_row_level off
stats_start_collector on
superuser_reserved_connections 2
syslog_facility LOCAL0
syslog_ident postgres
tcp_keepalives_count 9
tcp_keepalives_idle 7200
tcp_keepalives_interval 75
temp_buffers 1000
TimeZone EST5EDT
trace_notify off
trace_sort off
transaction_isolation read committed
transaction_read_only off
transform_null_equals off
unix_socket_directory unset
unix_socket_group unset
unix_socket_permissions 511
vacuum_cost_delay 0
vacuum_cost_limit 200
vacuum_cost_page_dirty 20
vacuum_cost_page_hit 1
vacuum_cost_page_miss 10
wal_buffers 8
wal_sync_method fdatasync
work_mem 65536
zero_damaged_pages off

Gracias de antemano.

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2007-08-03 23:24:19 Re: Out of memory (Failed on request of size 212).
Previous Message Alvaro Herrera 2007-08-03 21:58:16 Re: Obtener campos FK y PK