Aryeh Gregor wrote:
> On Fri, Jun 12, 2009 at 10:02 AM, Leons
> Petrazickis<[email protected]> wrote:
>> 1. Refactor the database to not use an integer as a bit field. Just
>> use four different boolean columns, which works well cross-database.
>
> In MySQL, four different boolean columns means four times the storage,
> as compared to one TINYINT used as a bitfield. So this isn't a good
> solution.
That's nonsense. We use a single TINYINT because it was introduced to
the schema as an unused boolean, and Brion later had the bright idea
of using it as a bitfield to expand its applications while avoiding
another schema change. It wouldn't make a significant difference to
database size if it were a text field with some complex ACL format,
like the old page.page_restrictions, and it's quite possible we would
have done that if the schema for it were designed from scratch.
However, we still want to avoid unnecessary schema changes to large
tables.
>> 2. Add a function to the Database API for each bit operator.
>>
>> $sql = $database->bitand('log_deleted', 1);
>>
>> 3. Add a function to the Database API to handle all the operators.
>>
>> $sql = $database->op('&', 'log_deleted', 1);
>> or
>> $sql = $database->op(Database::BITAND, 'log_deleted', 1);
>
> These would be the way to do it, I guess. We do something similar for
> things like conditionals already. I think 2 is preferable to 3,
> stylistically.
We also have the same scheme for string concatenation.
-- Tim Starling
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l