From dev-return-48647-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Fri Jan 19 22:34:07 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id E28C3180607 for ; Fri, 19 Jan 2018 22:34:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C62B6160C49; Fri, 19 Jan 2018 21:34:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E4C7B160C1B for ; Fri, 19 Jan 2018 22:34:06 +0100 (CET) Received: (qmail 22368 invoked by uid 500); 19 Jan 2018 21:34:06 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 22357 invoked by uid 99); 19 Jan 2018 21:34:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jan 2018 21:34:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 75B0818079F for ; Fri, 19 Jan 2018 21:34:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -107.911 X-Spam-Level: X-Spam-Status: No, score=-107.911 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_LOW=-0.7, 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-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id iT4jc97y8XmB for ; Fri, 19 Jan 2018 21:34:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 3CA175F343 for ; Fri, 19 Jan 2018 21:34:03 +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 0C0C1E0F37 for ; Fri, 19 Jan 2018 21:34:01 +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 551FD21209 for ; Fri, 19 Jan 2018 21:34:00 +0000 (UTC) Date: Fri, 19 Jan 2018 21:34:00 +0000 (UTC) From: "Sergey Soldatov (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-4544) Update statistics inconsistent behavior MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332914#comment-16332914 ] Sergey Soldatov commented on PHOENIX-4544: ------------------------------------------ Checked with 5.x branch, but it also may affect master as well. > Update statistics inconsistent behavior > ---------------------------------------- > > Key: PHOENIX-4544 > URL: https://issues.apache.org/jira/browse/PHOENIX-4544 > Project: Phoenix > Issue Type: Bug > Affects Versions: 5.0 > Reporter: Romil Choksi > Priority: Major > > Update statistics may not generate the stats information for all dependent indexes. And this behavior may depend on whether the command executed synchronously or asynchronously. > I have a table GIGANTIC_TABLE with ~500k rows with global index I1 and local index I2. > If async is turned on (the default value): > {noformat} > 0: jdbc:phoenix:> update statistics GIGANTIC_TABLE ALL; > No rows affected (0.081 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='I1' AND COLUMN_FAMILY='0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 5 | > +-------------------------------+ > 1 row selected (0.009 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='GIGANTIC_TABLE' AND COLUMN_FAMILY='0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 520 | > +-------------------------------+ > 1 row selected (0.014 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='GIGANTIC_TABLE' AND COLUMN_FAMILY='L#0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 0 | > +-------------------------------+ > 1 row selected (0.008 seconds) > 0: jdbc:phoenix:> > {noformat} > As we can see there is no records for local index I2. But if we run statistics for indexes: > {noformat} > 0: jdbc:phoenix:> update statistics GIGANTIC_TABLE INDEX; > No rows affected (0.036 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='GIGANTIC_TABLE' AND COLUMN_FAMILY='L#0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 20 | > +-------------------------------+ > 1 row selected (0.007 seconds) > {noformat} > the statistic for local index is generated correctly. > Now we turn async off: > {noformat} > 0: jdbc:phoenix:> delete from SYSTEM.STATS; > 547 rows affected (0.079 seconds) > 0: jdbc:phoenix:> update statistics GIGANTIC_TABLE ALL; > 999,998 rows affected (4.671 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='GIGANTIC_TABLE' AND COLUMN_FAMILY='0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 520 | > +-------------------------------+ > 1 row selected (0.04 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='GIGANTIC_TABLE' AND COLUMN_FAMILY='L#0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 20 | > +-------------------------------+ > 1 row selected (0.012 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='I1' AND COLUMN_FAMILY='0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 0 | > +-------------------------------+ > 1 row selected (0.011 seconds) > {noformat} > As we can see we got statistics for the table itself and local index. But not for the global index. > Moreover, if we try to update statistics for indexes: > {noformat} > 0: jdbc:phoenix:> update statistics GIGANTIC_TABLE INDEX; > 499,999 rows affected (0.332 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='I1' AND COLUMN_FAMILY='0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 0 | > +-------------------------------+ > 1 row selected (0.009 seconds) > {noformat} > So, still no records for global index. > But if we delete statistics first and run update for indexes: > {noformat} > 0: jdbc:phoenix:> delete from SYSTEM.STATS; > 541 rows affected (0.024 seconds) > 0: jdbc:phoenix:> update statistics GIGANTIC_TABLE INDEX; > 999,998 rows affected (0.41 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='I1' AND COLUMN_FAMILY='0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 5 | > +-------------------------------+ > 1 row selected (0.01 seconds) > 0: jdbc:phoenix:> select count(GUIDE_POSTS_ROW_COUNT) from SYSTEM.STATS WHERE PHYSICAL_NAME='GIGANTIC_TABLE' AND COLUMN_FAMILY='L#0'; > +-------------------------------+ > | COUNT(GUIDE_POSTS_ROW_COUNT) | > +-------------------------------+ > | 20 | > +-------------------------------+ > 1 row selected (0.01 seconds) > {noformat} > than we got statistics for both local and global indexes. -- This message was sent by Atlassian JIRA (v7.6.3#76005)