From: Chris Mair <chrisnospam@1006.org>
To: Christian Rengstl <Christian.Rengstl@klinik.uni-regensburg.de>
Cc: pgsql-general@postgresql.org
Subject: Re: Query performance
Date: Thu, 03 Aug 2006 11:57:06 +0200
Message-ID: <1154599026.5794.2.camel@dell.home.lan> (raw)
In-Reply-To: <44D1CC21.0AD0.0080.0@klinik.uni-regensburg.de>
References: <44D1CC21.0AD0.0080.0@klinik.uni-regensburg.de>
> i have a table with around 57 million tuples, with the following columns: pid(varchar), crit(varchar), val1(varchar), val2(varchar). Example:
> pid crit val1 val2
> p1 c1 x y
> p1 c2 x z
> p1 c3 y x
> ...
> What i am doing is to query all val1 and val2 for one pid and all crit values:
>
> select val1, val2, crit from mytable where pid='somepid' and crit in(select crit from myCritTable);
> where myCritTable is a table that contains all crit values (around 42.000) ordered by their insertion date.
In case myCritTable doesn't change a lot and this select by contrast is
executed a lot, have you considered precomputing whether a record from
your big table has a crit value from myCritTable?
Of course this info would be invalidated each time myCritTable is
updated, so you would trade fast selects on the big table vs. slow
updates on myCritTable. Don't know wether that makes sence for you...
Bye, Chris.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: chrisnospam@1006.org, Christian.Rengstl@klinik.uni-regensburg.de
Subject: Re: Query performance
In-Reply-To: <1154599026.5794.2.camel@dell.home.lan>
References: <44D1CC21.0AD0.0080.0@klinik.uni-regensburg.de> <1154599026.5794.2.camel@dell.home.lan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox