Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id C21BC17C2104 for ; Wed, 20 Jun 2012 23:46:09 -0300 (ADT) Received: from mail-yx0-f174.google.com ([209.85.213.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ShXPK-000733-0g for pgsql-performance@postgresql.org; Thu, 21 Jun 2012 02:46:08 +0000 Received: by yenl2 with SMTP id l2so110640yen.19 for ; Wed, 20 Jun 2012 19:45:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=w3OA17YURJ5VzK6HPWFB7YBrf7a7BASGVRK5WPg0By8=; b=BSDRM/J82Q5/MMdWXrQZFGZZ/lwEmZmuLgW0hAULNXxFJpAFUPru2Mu8kl4uEIL1h2 DJkSYfZWDGgkQbUwLROawgGRR8Mnu/oih0qnJinIMTPDLoiglKD62VL/TXCuPkCstSLx N2fAr2Y7B+8u5a/9zsvIfrB8n/49PN7F8yT8YgkV2AVHhy16UhoQgWugg8vGaGn738BK 8+KbzprWz1OGYsoRb7aeuE8clQML7fza86rPZGclwup4zd1zsAt6uXdiY1oQioctEAAx r0jinnK4H+DsF2JwaqC2tVFL1SIMarQlEOhkbruVKQsplbrVN2AEicEpmgQCw97EeVA6 WBgA== Received: by 10.50.196.195 with SMTP id io3mr4380232igc.39.1340246751336; Wed, 20 Jun 2012 19:45:51 -0700 (PDT) Received: from ayaki.localdomain (124-169-169-118.dyn.iinet.net.au. [124.169.169.118]) by mx.google.com with ESMTPS id gh2sm30544863igb.9.2012.06.20.19.45.43 (version=SSLv3 cipher=OTHER); Wed, 20 Jun 2012 19:45:45 -0700 (PDT) Message-ID: <4FE28AD5.5090702@ringerc.id.au> Date: Thu, 21 Jun 2012 10:45:41 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: sthomas@optionshouse.com CC: Eyal Wilde , pgsql-performance@postgresql.org Subject: Re: index-only scan is missing the INCLUDE feature References: <4FE1D9F9.1020805@ringerc.id.au> <4FE1ED03.3090709@optionshouse.com> In-Reply-To: <4FE1ED03.3090709@optionshouse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnNUe7PJJLdHDWKPytAWq+tnVismH7ZISM7VOE38dG0XCwIToOrU44ps3WlgvZWzJB1J9Av X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/115 X-Sequence-Number: 47141 On 06/20/2012 11:32 PM, Shaun Thomas wrote: > On 06/20/2012 09:11 AM, Craig Ringer wrote: > >> For those of us who don't know MS-SQL, can you give a quick >> explanation of what the INCLUDE keyword in an index definition is >> expected to do, or some documentation references? > > He's talking about what MS SQL Server commonly calls a "covering > index." In these cases, you can specify columns to be included in the > index, but not actually part of the calculated hash. This prevents a > trip to the table data, so selects can be serviced entirely by an > index scan. Oh, OK, so it's a covering index with added fields that don't form part of the searchable index structure to make the index a little less expensive than a fully covering index on all the columns of interest. Fair enough. Thanks for the explanation. Eyal, you'll get a better response to questions about other DBMSs if you explain what you need/want to do with the desired feature and what that feature does in the other DBMS. > > PostgreSQL is about half way there by allowing index-only scans, > though I've no idea if they intend on adding further functionality > like this. There's certainly lots of interest in adding more, but not that many people with the expertise to be able to do it - and fewer still who're paid to work on Pg so they have time to focus on it. Covering indexes with Pg's MVCC model seem to be particularly challenging, too. -- Craig Ringer