It definitely does that. The downsides are:
1. Selects that are looking for a particular individual value ("all items that reference user 1") are going to be a sequential scan.
2. You might get collisions on the adler32 function in real life; I'm not familiar enough with that particular function.
If you are using PostgreSQL, you might look at using intarray or hstore fields instead; those have the same advantages you enumerate, but you can also index on them in ways that will speed up searches for individual values.
--
-- Christophe Pettus
x...@thebuild.com
The standard Django implementation creates an intermediate table with foreign keys back to the tables on each side, so it's simple to do a query against that intermediate model to handle queries like that. (This is the standard SQL way of handling a many-to-many relationship.)
In fact, in your structure, I'm not sure you can actually answer the question "which items refer to user 1," since that information is lost into the hash. If the only question you ever need to answer is "does item 1 refer to this particular set of users?", then that's not a big deal.
>> If you are using PostgreSQL, you might look at using intarray or hstore fields instead; those have the same advantages you enumerate, but you can also index on them in ways that will speed up searches for individual values.
>
> Outside of the ORM I'll play around with this.
You don't need to abandon the ORM to use hstore or intarray; they adapt very nicely to Pyython types and Django model types.