Re: FW: KVP table vs. hstore - hstore performance (Was: Postgres NoSQL emulation) - Mailing list pgsql-performance

From Pierre C
Subject Re: FW: KVP table vs. hstore - hstore performance (Was: Postgres NoSQL emulation)
Date
Msg-id op.vv20eyc1eorkce@apollo13
Whole thread Raw
In response to Re: FW: KVP table vs. hstore - hstore performance (Was: Postgres NoSQL emulation)  (Stefan Keller <sfkeller@gmail.com>)
List pgsql-performance
> My problem is, that in fact I don't know which tag to index since I'm
> running a web admin application where users can enter arbitrary
> queries.

For a tag cloud, try this :

- table tags ( tag_id, tag_name )
- table articles ( article_id )
- table articles_to_tags( article_id, tag_id )

now this is the classical approach, which doesn't work so well when you
want to get an article that has several tags (tag intersection).

So, materialize the list of tag_ids for each article in an INTEGER[] array
in the articles table, kept up to date with triggers.

Create a gist index on that, and use indexed array vs array operators.

pgsql-performance by date:

Previous
From: Jochen Erwied
Date:
Subject: Re: Speeding up loops in pl/pgsql function
Next
From: Merlin Moncure
Date:
Subject: Re: Speeding up loops in pl/pgsql function