command line interface - MySQL Query with LARGE number of records gets Killed -
i run following query shell :
mysql -h my-host.net -u myuser -p -e "select component_id, parent_component_id myschema.components comp inner join my_second_schema.component_parents related_comp on comp.id = related_comp.component_id order component_id;" > /tmp/it_component_parents.txt
the query runs long time , gets killed.
however if add limit 1000
, query runs till end , output written in file.
i further investigated , found (using count(*)) total number of records returned 239553163.
some information server here:
mysql 5.5.27
+----------------------------+----------+ | variable_name | value | +----------------------------+----------+ | connect_timeout | 10 | | delayed_insert_timeout | 300 | | innodb_lock_wait_timeout | 50 | | innodb_rollback_on_timeout | off | | interactive_timeout | 28800 | | lock_wait_timeout | 31536000 | | net_read_timeout | 30 | | net_write_timeout | 60 | | slave_net_timeout | 3600 | | wait_timeout | 28800 | +----------------------------+----------+
here's state of query monitored :
copying tmp table on disk sorting results sending data writing net sending data writing net sending data writing net sending data ... killed
any guesses what's wrong here ?
the mysql client runs out of memory.
use --quick option not buffer results in memory.
Comments
Post a Comment