From commits-return-12948-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Fri Mar 2 09:27:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 25D7C180679 for ; Fri, 2 Mar 2018 09:27:05 +0100 (CET) Received: (qmail 99837 invoked by uid 500); 2 Mar 2018 08:27:04 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 99714 invoked by uid 99); 2 Mar 2018 08:27:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2018 08:27:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id E35BEC02AA for ; Fri, 2 Mar 2018 08:27:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id PZUKWZWSrC7R for ; Fri, 2 Mar 2018 08:27:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 2A4AF5F3CD for ; Fri, 2 Mar 2018 08:27:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 9C31EE021B for ; Fri, 2 Mar 2018 08:27:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3760524768 for ; Fri, 2 Mar 2018 08:27:00 +0000 (UTC) Date: Fri, 2 Mar 2018 08:27:00 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-2059) taskinstance query is awful, un-indexed, and does not scale MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AIRFLOW-2059?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 383340#comment-16383340 ]=20 ASF subversion and git services commented on AIRFLOW-2059: ---------------------------------------------------------- Commit d4dfe2654e16d1ae2e7464e642a3520de04496e2 in incubator-airflow's bran= ch refs/heads/master from Tao feng [ https://git-wip-us.apache.org/repos/asf?p=3Dincubator-airflow.git;h=3Dd4d= fe26 ] [AIRFLOW-2059] taskinstance query is awful, un-indexed, and does not scale Closes #3086 from feng-tao/airflow-2059 > taskinstance query is awful, un-indexed, and does not scale > ----------------------------------------------------------- > > Key: AIRFLOW-2059 > URL: https://issues.apache.org/jira/browse/AIRFLOW-2059 > Project: Apache Airflow > Issue Type: Bug > Components: db, webserver > Affects Versions: Airflow 1.8 > Environment: [nhanlon@ ~]$ nproc > 4 > [nhanlon@ ~]$ free -g > total used free shared buffers cached > Mem: 7 5 1 0 0 1 > -/+ buffers/cache: 4 3=20 > Swap: 0 0 0=20 > [nhanlon@ ~]$ cat /etc/*release* > CentOS release 6.7 (Final) > CentOS release 6.7 (Final) > CentOS release 6.7 (Final) > cpe:/o:centos:linux:6:GA > [nhanlon@ ~]$ mysqld --version > mysqld Ver 5.6.31-77.0 for Linux on x86_64 (Percona Server (GPL), Releas= e 77.0, Revision 5c1061c) > Reporter: Neil Hanlon > Assignee: Tao Feng > Priority: Critical > > =C2=A0 > The page at /admin/taskinstance/ can reach a point where it blocks loadin= g the page and crushes the database. It appears this is because the task_in= stance.job_id column is unindexed. On our database, getting the results for= this query took over four minutes, locking the table for the duration. > =C2=A0 > 500 rows in set (4 min 8.93 sec) > =C2=A0 > Query: > =C2=A0 > {code:java} > SELECT task_instance.task_id AS task_instance_task_id, task_instance.dag_= id AS task_instance_dag_id, task_instance.execution_date AS task_instance_e= xecution_date, task_instance.start_date AS task_instance_start_date, task_i= nstance.end_date AS task_instance_end_date, task_instance.duration AS task_= instance_duration, task_instance.state AS task_instance_state, task_instanc= e.try_number AS task_instance_try_number, task_instance.hostname AS task_in= stance_hostname, task_instance.unixname AS task_instance_unixname, task_ins= tance.job_id AS task_instance_job_id, task_instance.pool AS task_instance_p= ool, task_instance.queue AS task_instance_queue, task_instance.priority_wei= ght AS task_instance_priority_weight, task_instance.operator AS task_instan= ce_operator, task_instance.queued_dttm AS task_instance_queued_dttm, task_i= nstance.pid AS task_instance_pid=20 > FROM task_instance ORDER BY task_instance.job_id DESC=20 > LIMIT 500; > {code} > Profile, explain: > =C2=A0 > {code:java} > :airflow> EXPLAIN SELECT task_instance.task_id AS task_instance= _task_id, task_instance.dag_id AS task_instance_dag_id, task_instance.execu= tion_date AS task_instance_execution_date, task_instance.start_date AS task= _instance_start_date, task_instance.end_date AS task_instance_end_date, tas= k_instance.duration AS task_instance_duration, task_instance.state AS task_= instance_state, task_instance.try_number AS task_instance_try_number, task_= instance.hostname AS task_instance_hostname, task_instance.unixname AS task= _instance_unixname, task_instance.job_id AS task_instance_job_id, task_inst= ance.pool AS task_instance_pool, task_instance.queue AS task_instance_queue= , task_instance.priority_weight AS task_instance_priority_weight, task_inst= ance.operator AS task_instance_operator, task_instance.queued_dttm AS task_= instance_queued_dttm, task_instance.pid AS task_instance_pid=20 > -> FROM task_instance ORDER BY task_instance.job_id DESC=20 > -> LIMIT 500; > +----+-------------+---------------+------+---------------+------+-------= --+------+---------+----------------+ > | id | select_type | table | type | possible_keys | key | key_len | ref |= rows | Extra | > +----+-------------+---------------+------+---------------+------+-------= --+------+---------+----------------+ > | 1 | SIMPLE | task_instance | ALL | NULL | NULL | NULL | NULL | 2542776 = | Using filesort | > +----+-------------+---------------+------+---------------+------+-------= --+------+---------+----------------+ > 1 row in set (0.00 sec) > :airflow> select count(*) from task_instance; > +----------+ > | count(*) | > +----------+ > | 2984749 | > +----------+ > 1 row in set (1.67 sec) > :airflow> show profile for query 2; > +----------------------+------------+ > | Status | Duration | > +----------------------+------------+ > | starting | 0.000157 | > | checking permissions | 0.000017 | > | Opening tables | 0.000033 | > | init | 0.000046 | > | System lock | 0.000017 | > | optimizing | 0.000010 | > | statistics | 0.000022 | > | preparing | 0.000020 | > | Sorting result | 0.000010 | > | executing | 0.000008 | > | Sending data | 0.000151 | > | Creating sort index | 248.955841 | > | end | 0.015358 | > | query end | 0.000012 | > | closing tables | 0.000019 | > | freeing items | 0.000549 | > | logging slow query | 0.000007 | > | logging slow query | 0.000901 | > | cleaning up | 0.000030 | > +----------------------+------------+ > 19 rows in set, 1 warning (0.00 sec) > {code} > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)