Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 1718 invoked from network); 20 Mar 2007 19:52:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2007 19:52:44 -0000 Received: (qmail 60132 invoked by uid 500); 20 Mar 2007 19:52:50 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 60098 invoked by uid 500); 20 Mar 2007 19:52:50 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 60077 invoked by uid 99); 20 Mar 2007 19:52:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2007 12:52:50 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [4.78.240.39] (HELO mta02.zimbra.com) (4.78.240.39) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2007 12:52:38 -0700 Received: from dogfood.zimbra.com (dogfood.liquidsys.com [66.92.25.198]) by mta02.zimbra.com (Postfix) with ESMTP id AF49E810C2E for ; Tue, 20 Mar 2007 11:46:04 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by dogfood.zimbra.com (Postfix) with ESMTP id 8B5FA774C2 for ; Tue, 20 Mar 2007 12:52:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at dogfood.zimbra.com Received: from dogfood.zimbra.com ([127.0.0.1]) by localhost (dogfood.zimbra.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dCiBxgR3lUwK for ; Tue, 20 Mar 2007 12:52:12 -0700 (PDT) Received: from dogfood.zimbra.com (localhost.localdomain [127.0.0.1]) by dogfood.zimbra.com (Postfix) with ESMTP id A0997774C3 for ; Tue, 20 Mar 2007 12:52:12 -0700 (PDT) Date: Tue, 20 Mar 2007 12:52:12 -0700 (PDT) From: Dan Karp To: derby-user Message-ID: <1268876681.82631174420332494.JavaMail.root@dogfood.liquidsys.com> Subject: Queries satisfiable from indexes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [75.23.60.148] X-Virus-Checked: Checked by ClamAV on apache.org I've got a few queries that should be satisfiable from an index without any access to the underlying rows. Can Derby do this, or does it load the rows regardless? In this case, would it help things if I'd used DISTINCT(tags) instead of a GROUP BY clause? QUERY: SELECT tags FROM mboxgroup1.mail_item WHERE mailbox_id = ? GROUP BY mailbox_id, tags; INDEX: CREATE INDEX ${DATABASE_NAME}.i_mail_item_tags_date ON mail_item(mailbox_id, tags, date); PLAN: Number of opens = 1 Rows seen = 3 Rows filtered = 0 restriction = false projection = true constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 restriction time (milliseconds) = 0 projection time (milliseconds) = 0 optimizer estimated row count: 14134.80 optimizer estimated cost: 5049.44 Source result set: Sort ResultSet: Number of opens = 1 Rows input = 141512 Rows returned = 3 Eliminate duplicates = true In sorted order = true constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 optimizer estimated row count: 14134.80 optimizer estimated cost: 5049.44 Source result set: Project-Restrict ResultSet (3): Number of opens = 1 Rows seen = 141512 Rows filtered = 0 restriction = false projection = true constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 restriction time (milliseconds) = 0 projection time (milliseconds) = 0 optimizer estimated row count: 14134.80 optimizer estimated cost: 5049.44 Source result set: Index Scan ResultSet for MAIL_ITEM using index I_MAIL_ITEM_TAGS_DATE at read committed isolation level using share row locking chosen by the optimizer Number of opens = 1 Rows seen = 141512 Rows filtered = 0 Fetch Size = 1 constructor time (milliseconds) = 0 open time (milliseconds) = 0 next time (milliseconds) = 0 close time (milliseconds) = 0 next time in milliseconds/row = 0 scan information: Bit set of columns fetched={0, 1} Number of columns fetched=2 Number of deleted rows visited=20458 Number of pages visited=501 Number of rows qualified=141512 Number of rows visited=161970 Scan type=btree Tree height=3 start position: >= on first 1 column(s). Ordered null semantics on the following columns: stop position: > on first 1 column(s). Ordered null semantics on the following columns: qualifiers: None optimizer estimated row count: 14134.80 optimizer estimated cost: 5049.44