Code Monkey home page Code Monkey logo

hstore_ops's Introduction

PostgreSQL Database Management System
=====================================

This directory contains the source code distribution of the PostgreSQL
database management system.

PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, user-defined types
and functions.  This distribution also contains C language bindings.

PostgreSQL has many language interfaces, many of which are listed here:

	http://www.postgresql.org/download

See the file INSTALL for instructions on how to build and install
PostgreSQL.  That file also lists supported operating systems and
hardware platforms and contains information regarding any other
software packages that are required to build or run the PostgreSQL
system.  Copyright and license information can be found in the
file COPYRIGHT.  A comprehensive documentation set is included in this
distribution; it can be read as described in the installation
instructions.

The latest version of this software may be obtained at
http://www.postgresql.org/download/.  For more information look at our
web site located at http://www.postgresql.org/.

hstore_ops's People

Contributors

akorotkov avatar feodor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hstore_ops's Issues

? operator seems slower than regular gin

I did a quick test on postgresql 9.4 week old snapshot and some sample osm data -- you can find here if you want to repeat -- http://www.postgresonline.com/downloads/osm_hstore_test.zip (it's only 50,540 records so still small.
Quick conclusion -- the @> does seem consistently faster, but the ? seems slower. Is that expected?

Here is output of my tests:
Data: http://www.postgresonline.com/downloads/osm_hstore_test.zip

SELECT * INTO osm_pt_wgin FROM osm_pt;
CREATE INDEX idx_osm_pt_wgin_tags ON osm_pt_wgin USING gin(tags);
VACUUM ANALYZE osm_pt_wgin;

SELECT * INTO osm_pt_wginops FROM osm_pt;
CREATE INDEX idx_osm_pt_wginops_tags ON osm_pt_wginops USING gin(tags gin_hstore_hash_ops);
VACUUM ANALYZE osm_pt_wginops;
---------------------------------------------------------------
EXPLAIN ANALYZE VERBOSE SELECT name, tags->'cuisine'
  FROM osm_pt_wginops
  WHERE tags @> 'cuisine =>"indian"'::hstore or tags @> 'cuisine => "japanese"'::hstore;

Bitmap Heap Scan on public.osm_pt_wginops  (cost=24.81..287.33 rows=101 width=72) (actual time=0.061..0.133 rows=28 loops=1)
  Output: name, (tags -> 'cuisine'::text)
  Recheck Cond: ((osm_pt_wginops.tags @> '"cuisine"=>"indian"'::hstore) OR (osm_pt_wginops.tags @> '"cuisine"=>"japanese"'::hstore))
  Heap Blocks: exact=28
  ->  BitmapOr  (cost=24.81..24.81 rows=101 width=0) (actual time=0.038..0.038 rows=0 loops=1)
        ->  Bitmap Index Scan on idx_osm_pt_wginops_tags  (cost=0.00..12.38 rows=51 width=0) (actual time=0.025..0.025 rows=8 loops=1)
              Index Cond: (osm_pt_wginops.tags @> '"cuisine"=>"indian"'::hstore)
        ->  Bitmap Index Scan on idx_osm_pt_wginops_tags  (cost=0.00..12.38 rows=51 width=0) (actual time=0.011..0.011 rows=20 loops=1)
              Index Cond: (osm_pt_wginops.tags @> '"cuisine"=>"japanese"'::hstore)
Planning time: 0.131 ms
Execution time: 0.225 ms
-----------------------------------------------------------------------------
EXPLAIN ANALYZE VERBOSE SELECT name, tags->'cuisine'
  FROM osm_pt_wgin
  WHERE tags @> 'cuisine =>"indian"'::hstore or tags @> 'cuisine => "japanese"'::hstore;

Bitmap Heap Scan on public.osm_pt_wgin  (cost=40.81..303.33 rows=101 width=72) (actual time=0.161..0.232 rows=28 loops=1)
  Output: name, (tags -> 'cuisine'::text)
  Recheck Cond: ((osm_pt_wgin.tags @> '"cuisine"=>"indian"'::hstore) OR (osm_pt_wgin.tags @> '"cuisine"=>"japanese"'::hstore))
  Heap Blocks: exact=28
  ->  BitmapOr  (cost=40.81..40.81 rows=101 width=0) (actual time=0.138..0.138 rows=0 loops=1)
        ->  Bitmap Index Scan on idx_osm_pt_wgin_tags  (cost=0.00..20.38 rows=51 width=0) (actual time=0.078..0.078 rows=8 loops=1)
              Index Cond: (osm_pt_wgin.tags @> '"cuisine"=>"indian"'::hstore)
        ->  Bitmap Index Scan on idx_osm_pt_wgin_tags  (cost=0.00..20.38 rows=51 width=0) (actual time=0.058..0.058 rows=20 loops=1)
              Index Cond: (osm_pt_wgin.tags @> '"cuisine"=>"japanese"'::hstore)
Planning time: 0.121 ms
Execution time: 0.333 ms
---------------------------
EXPLAIN ANALYZE VERBOSE SELECT name, tags->'shop', tags->'restaurant', tags->'food', tags->'cuisine'
  FROM osm_pt_wginops
  where tags ? 'shop' or tags ? 'restaurant' or tags ? 'food' or tags ? 'cuisine';

Bitmap Heap Scan on public.osm_pt_wginops  (cost=81.72..497.54 rows=202 width=72) (actual time=1.169..4.851 rows=1681 loops=1)
  Output: name, (tags -> 'shop'::text), (tags -> 'restaurant'::text), (tags -> 'food'::text), (tags -> 'cuisine'::text)
  Recheck Cond: ((osm_pt_wginops.tags ? 'shop'::text) OR (osm_pt_wginops.tags ? 'restaurant'::text) OR (osm_pt_wginops.tags ? 'food'::text) OR (osm_pt_wginops.tags ? 'cuisine'::text))
  Heap Blocks: exact=464
  ->  BitmapOr  (cost=81.72..81.72 rows=202 width=0) (actual time=1.053..1.053 rows=0 loops=1)
        ->  Bitmap Index Scan on idx_osm_pt_wginops_tags  (cost=0.00..20.38 rows=51 width=0) (actual time=0.596..0.596 rows=972 loops=1)
              Index Cond: (osm_pt_wginops.tags ? 'shop'::text)
        ->  Bitmap Index Scan on idx_osm_pt_wginops_tags  (cost=0.00..20.38 rows=51 width=0) (actual time=0.011..0.011 rows=1 loops=1)
              Index Cond: (osm_pt_wginops.tags ? 'restaurant'::text)
        ->  Bitmap Index Scan on idx_osm_pt_wginops_tags  (cost=0.00..20.38 rows=51 width=0) (actual time=0.018..0.018 rows=11 loops=1)
              Index Cond: (osm_pt_wginops.tags ? 'food'::text)
        ->  Bitmap Index Scan on idx_osm_pt_wginops_tags  (cost=0.00..20.38 rows=51 width=0) (actual time=0.424..0.424 rows=704 loops=1)
              Index Cond: (osm_pt_wginops.tags ? 'cuisine'::text)
Planning time: 0.349 ms
Execution time: 5.296 ms
--------------------------
EXPLAIN ANALYZE VERBOSE SELECT name, tags->'shop', tags->'restaurant', tags->'food', tags->'cuisine'
  FROM osm_pt_wgin
  where tags ? 'shop' or tags ? 'restaurant' or tags ? 'food' or tags ? 'cuisine';

Bitmap Heap Scan on public.osm_pt_wgin  (cost=49.72..465.54 rows=202 width=72) (actual time=0.651..3.139 rows=1681 loops=1)
  Output: name, (tags -> 'shop'::text), (tags -> 'restaurant'::text), (tags -> 'food'::text), (tags -> 'cuisine'::text)
  Recheck Cond: ((osm_pt_wgin.tags ? 'shop'::text) OR (osm_pt_wgin.tags ? 'restaurant'::text) OR (osm_pt_wgin.tags ? 'food'::text) OR (osm_pt_wgin.tags ? 'cuisine'::text))
  Heap Blocks: exact=464
  ->  BitmapOr  (cost=49.72..49.72 rows=202 width=0) (actual time=0.539..0.539 rows=0 loops=1)
        ->  Bitmap Index Scan on idx_osm_pt_wgin_tags  (cost=0.00..12.38 rows=51 width=0) (actual time=0.311..0.311 rows=972 loops=1)
              Index Cond: (osm_pt_wgin.tags ? 'shop'::text)
        ->  Bitmap Index Scan on idx_osm_pt_wgin_tags  (cost=0.00..12.38 rows=51 width=0) (actual time=0.019..0.019 rows=1 loops=1)
              Index Cond: (osm_pt_wgin.tags ? 'restaurant'::text)
        ->  Bitmap Index Scan on idx_osm_pt_wgin_tags  (cost=0.00..12.38 rows=51 width=0) (actual time=0.020..0.020 rows=11 loops=1)
              Index Cond: (osm_pt_wgin.tags ? 'food'::text)
        ->  Bitmap Index Scan on idx_osm_pt_wgin_tags  (cost=0.00..12.38 rows=51 width=0) (actual time=0.187..0.187 rows=704 loops=1)
              Index Cond: (osm_pt_wgin.tags ? 'cuisine'::text)
Planning time: 0.143 ms
Execution time: 3.311 ms```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.