Planner question - "bit" data types

From: Karl Denninger <karl(at)denninger(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Planner question - "bit" data types
Date: 2009-09-04 19:15:19
Message-ID: 4AA16747.50100@denninger.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Does the planner know how to use indices to optimize these queries?

For reference, I was having SEVERE performance problems with the
following comparison in an SQL statement where "mask" was an integer:

"select ... from .... where ...... and (permission & mask = permission)"

This resulted in the planner deciding to run a nested loop and
extraordinarily poor performance.

I can probably recode the application to use a field of type "bit(32)"
and either cast to an integer or have the code do the conversion
internally (its just a shift eh?)

The question is whether the above statement will be reasonably planned
if "mask" is a bit type.

-- Karl Denninger

Attachment Content-Type Size
karl.vcf text/x-vcard 124 bytes

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Otis 2009-09-04 21:55:50 Re: Seeking performance advice and explanation for high I/O on 8.3
Previous Message Vincent de Phily 2009-09-04 10:39:21 slow query : very simple delete, 100% cpu, nearly no disk activity