Re: How to properly index hstore tags column to faster search for keys

From: Richard Huxton <dev(at)archonet(dot)com>
To: Radu-Stefan Zugravu <raduzugravu90(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: How to properly index hstore tags column to faster search for keys
Date: 2013-07-08 10:27:34
Message-ID: 51DA9416.70200@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 08/07/13 10:20, Radu-Stefan Zugravu wrote:
> Any improvement is welcomed. The overall performance of the application
> is not very good. It takes about 200 seconds to compute a path for not
> so far star and end points.

So you have to call this query 1000 times with different start and end
points?

> I want to improve this query as much as I can.

There's only two ways I can see to get this much below 20ms. This will
only work if you want a very restricted range of tags.

Drop the tag index and create multiple geometry indexes instead:

CREATE INDEX node_geo_tourist_idx <index details> WHERE tags ? 'tourist';
CREATE INDEX node_geo_tourist_idx <index details> WHERE tags ? 'history';
etc.

This will only work if you have a literal WHERE clause that checks the
tag. It should be fast though.

The second way would be to delete all the nodes that aren't tagged
tourist or history. That assumes you are never interested in them of course.

> How exactly should I post the explain without the index? Do I have to
> drop all created indexes for the tags column? It takes some time to
> create them back.

Not important - I was just curious.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Radu-Stefan Zugravu 2013-07-08 11:01:02 Re: How to properly index hstore tags column to faster search for keys
Previous Message Radu-Stefan Zugravu 2013-07-08 09:20:13 Re: How to properly index hstore tags column to faster search for keys