Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A0795B5DBD3 for ; Mon, 23 May 2011 08:00:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 75387-03 for ; Mon, 23 May 2011 11:00:41 +0000 (UTC) X-Greylist: delayed 00:06:37.852855 by SQLgrey-1.7.6 Received: from 29.mail-out.ovh.net (29.mail-out.ovh.net [87.98.216.213]) by mail.postgresql.org (Postfix) with SMTP id 35340B5DBC2 for ; Mon, 23 May 2011 08:00:41 -0300 (ADT) Received: (qmail 3604 invoked by uid 503); 23 May 2011 11:01:34 -0000 Received: from b6.ovh.net (HELO mail170.ha.ovh.net) (213.186.33.56) by 29.mail-out.ovh.net with SMTP; 23 May 2011 11:01:34 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 23 May 2011 12:53:59 +0200 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13) (lists%peufeu.com@88.161.102.87) by ns0.ovh.net with SMTP; 23 May 2011 12:53:58 +0200 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: mmoncure@gmail.com, sfkeller@gmail.com, pgsql-performance@postgresql.org, m1ott@hsr.ch Subject: Re: FW: KVP table vs. hstore - hstore performance (Was: Postgres NoSQL emulation) References: <4DD06EF3.7030003@postnewspapers.com.au> <99EECF01B5C87A498318776AB7E4A78D3640F59E26@sid00102.hsr.ch> Date: Mon, 23 May 2011 12:53:57 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Pierre C" Message-ID: In-Reply-To: <99EECF01B5C87A498318776AB7E4A78D3640F59E26@sid00102.hsr.ch> User-Agent: Opera Mail/11.10 (Linux) X-Ovh-Tracer-Id: 4379187687807125086 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.59 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_RP_RNBL=1.31 X-Spam-Level: X-Archive-Number: 201105/296 X-Sequence-Number: 43805 > Hi Merlin > > The analyze command gave the following result: > > On the KVP table: > Index Scan using kvpidx on bench_kvp (cost=0.00..8.53 rows=1 width=180) > (actual time=0.037..0.038 rows=1 loops=1) > Index Cond: (bench_id = '200000_200000'::text) > Total runtime: 0.057 ms > > And on the Hstore table: > Bitmap Heap Scan on bench_hstore (cost=32.22..3507.54 rows=1000 > width=265) (actual time=145.040..256.173 rows=1 loops=1) > Recheck Cond: (bench_hstore @> '"bench_id"=>"200000_200000"'::hstore) > -> Bitmap Index Scan on hidx (cost=0.00..31.97 rows=1000 width=0) > (actual time=114.748..114.748 rows=30605 loops=1) > Index Cond: (bench_hstore @> '"bench_id"=>"200000_200000"'::hstore) > Total runtime: 256.211 ms > > For Hstore I'm using a GIST index. > Try to create a btree index on "(bench_hstore->bench_id) WHERE (bench_hstore->bench_id) IS NOT NULL".