Re: schema advice for event stream with tagging and filtering - Mailing list pgsql-general

From Chris Withers
Subject Re: schema advice for event stream with tagging and filtering
Date
Msg-id 0a47418c-da6e-b928-86b2-0c4917502303@simplistix.co.uk
Whole thread Raw
In response to Re: schema advice for event stream with tagging and filtering  ("Ilya Kazakevich" <Ilya.Kazakevich@JetBrains.com>)
Responses Re: schema advice for event stream with tagging and filtering  ("Ilya Kazakevich" <Ilya.Kazakevich@JetBrains.com>)
List pgsql-general
On 16/08/2016 14:29, Ilya Kazakevich wrote:
> Hi,
>
>> An event is a row with a primary key along the lines of (colo, host,
>> category) and an associated set of tags, where each tag has a type and a value
>> (eg: {"color": "red", "owner": "fred", "status": "open"...}).
>
> What about  simple table with several columns and hstore  field for tags?

Interesting!

> You may also normalize it (move hosts and categories to separate table).

Why? These form part of the primary key for the event...

> indexes should help you with fast filtering, or you may load data from this table to denormalized olap table once a
dayand build index there to speed-up queries. 

What kind of index is recommended here? The kind of queries would be:

- show me a list of tag types and the count of the number of events of
that type

- show me all events that have tag1=x, tag2=y and does not have tag3

cheers,

Chris


pgsql-general by date:

Previous
From: "Ilya Kazakevich"
Date:
Subject: Re: schema advice for event stream with tagging and filtering
Next
From: "Ilya Kazakevich"
Date:
Subject: Re: schema advice for event stream with tagging and filtering