From: Pierre Frédéric Caillaud <lists@peufeu.com>
To: Karl Denninger <karl@denninger.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] SQL Query Performance - what gives?
Date: Wed, 19 Aug 2009 08:27:52 +0200
Message-ID: <op.uywb8qyucke6l8@soyouz> (raw)
In-Reply-To: <4A8B67DD.2020608@denninger.net>
References: <4A8B04C7.6060702@denninger.net>
<4A8AC75C0200002500029C8A@gw.wicourts.gov>
<4A8B1606.2040209@denninger.net>
<4A8ADDEA0200002500029CA3@gw.wicourts.gov>
<4A8B334F.1010801@denninger.net>
<9800.1250647338@sss.pgh.pa.us>
<4A8B67DD.2020608@denninger.net>
> The bitmask allows the setting of multiple permissions but the table
> definition doesn't have to change (well, so long as the bits fit into a
> word!) Finally, this is a message forum - the actual code itself is
> template-driven and the bitmask permission structure is ALL OVER the
> templates; getting that out of there would be a really nasty rewrite,
> not to mention breaking the user (non-developer, but owner)
> extensibility of the current structure.
>
> Is there a way to TELL the planner how to deal with this, even if it
> makes the SQL non-portable or is a hack on the source mandatory?
You could use an integer array instead of a bit mask, make a gist index
on it, and instead of doing "mask & xxx" do "array contains xxx", which is
indexable with gist. The idea is that it can get much better row
estimation. Instead of 1,2,3, you can use 1,2,4,8, etc if you like. you'd
probably need a function to convert a bitmask into ints and another to do
the conversion back, so the rest of your app gets the expected bitmasks.
Or add a bitmask type to postgres with ptoper statistics...
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lists@peufeu.com, karl@denninger.net, tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov, pgsql-performance@postgresql.org
Subject: Re: [SQL] SQL Query Performance - what gives?
In-Reply-To: <op.uywb8qyucke6l8@soyouz>
* 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