Re: [GENERAL] Bit datatype performance?

2011-09-15 Thread Harald Fuchs
In article , Antonio Vieiro writes: > Hi all, > One of my entities 'E' may be 'tagged' with an arbitrary set of 256 tags 'T'. > A first approach could be to add a M:N relationship between 'E' and 'T'. > A second way to do this could be to add a BIT(256) datatype to 'E', > setting bits to '1' if

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread Antonio Vieiro
Hi, Thanks for the tip. Maybe two UUIDs are a best approach. I'll see which is more performant. Kind regards, Antonio El 14/09/11 19:32, Radosław Smogura escribió: Hi, I think it's not bad approach if performance is important. I don't know how b-tree index will work with bitset datatype, bu

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread Eduardo Piombino
Hi, if you are thinking to access data in that manner, what's the point of bits (or tags)? The idea behind having a value and then using a bitmask is to be able to test the value against different bitmasks, each bitmask corresponding to a different tag or tag combination. The *where *statement yo

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread Radosław Smogura
Hi, I think it's not bad approach if performance is important. I don't know how b-tree index will work with bitset datatype, but I assume it should treat is as 256bit number (maybe someone more competive in internals will answer this). Please bear in mind, that this approach will work well o

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread Antonio Vieiro
Hi again, Thanks for the tip. In fact I was thinking of creating an index on the bitmask, so I could use: ... where t.bits = :mymask directly, avoiding a full table scan. I assume this is possible (indexing bit and comparing bits), isn't it? Thanks, Antonio El 14/09/11 15:58, Radosław Smo

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread pasman pasmański
Other option is use an array of int2 instead of bit(256). It can be indexed. 2011/9/14, Radosław Smogura : > On Wed, 14 Sep 2011 12:00:35 +0200, Antonio Vieiro wrote: >> Hi all, >> >> One of my entities 'E' may be 'tagged' with an arbitrary set of 256 >> tags 'T'. >> >> A first approach coul

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread Radosław Smogura
On Wed, 14 Sep 2011 12:00:35 +0200, Antonio Vieiro wrote: Hi all, One of my entities 'E' may be 'tagged' with an arbitrary set of 256 tags 'T'. A first approach could be to add a M:N relationship between 'E' and 'T'. A second way to do this could be to add a BIT(256) datatype to 'E', setti

Re: [GENERAL] Bit datatype performance?

2011-09-14 Thread David Johnston
On Sep 14, 2011, at 6:00, Antonio Vieiro wrote: > Hi all, > > One of my entities 'E' may be 'tagged' with an arbitrary set of 256 tags 'T'. > > A first approach could be to add a M:N relationship between 'E' and 'T'. > > A second way to do this could be to add a BIT(256) datatype to 'E', > se