Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 07670200BF1 for ; Tue, 3 Jan 2017 08:08:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 06141160B46; Tue, 3 Jan 2017 07:08:00 +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 519A5160B33 for ; Tue, 3 Jan 2017 08:07:59 +0100 (CET) Received: (qmail 21559 invoked by uid 500); 3 Jan 2017 07:07:58 -0000 Mailing-List: contact issues-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list issues@ignite.apache.org Received: (qmail 21530 invoked by uid 99); 3 Jan 2017 07:07:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jan 2017 07:07:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 65F972C03DC for ; Tue, 3 Jan 2017 07:07:58 +0000 (UTC) Date: Tue, 3 Jan 2017 07:07:58 +0000 (UTC) From: "Vladimir Ozerov (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (IGNITE-4150) B-Tree index cannot be used efficiently with IN clause. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 03 Jan 2017 07:08:00 -0000 [ https://issues.apache.org/jira/browse/IGNITE-4150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vladimir Ozerov updated IGNITE-4150: ------------------------------------ Description: Consider the following query: {code} SELECT * FROM table WHERE a = ? AND b IN (?, ?) {code} If there is an index {{(a, b)}}, it will not be used properly: only column {{a}} will be used. This will leads to multiple unnecessary comparisons. Most obvious way to fix that - use temporary table and {{JOIN}}. However, this approach doesn't work well when there are multiple {{IN}}'s. Proper solution would be to hack deeper into H2. was: Consider the following query: {code} SELECT * FROM table WHERE a = ? AND b IN (?, ?) {code} If there is an index {{(a, b)}}, it will not be used properly: only column {{a}} will be used. This will leads to multiple unnecessary comparisons. Most obvious way to fix that - use temporary table and {{JOIN}}. However, this approach doesn't work well when there are multiple {{IN}}s. Proper solution would be to hack deeper into H2. > B-Tree index cannot be used efficiently with IN clause. > ------------------------------------------------------- > > Key: IGNITE-4150 > URL: https://issues.apache.org/jira/browse/IGNITE-4150 > Project: Ignite > Issue Type: Task > Components: SQL > Affects Versions: 1.7 > Reporter: Vladimir Ozerov > Labels: performance > Fix For: 2.0 > > > Consider the following query: > {code} > SELECT * FROM table > WHERE a = ? AND b IN (?, ?) > {code} > If there is an index {{(a, b)}}, it will not be used properly: only column {{a}} will be used. This will leads to multiple unnecessary comparisons. > Most obvious way to fix that - use temporary table and {{JOIN}}. However, this approach doesn't work well when there are multiple {{IN}}'s. > Proper solution would be to hack deeper into H2. -- This message was sent by Atlassian JIRA (v6.3.4#6332)