Script creates schema and data. The following query must use range
search for the second table instead of 'ref'.

SELECT STRAIGHT_JOIN g.id FROM acl a, grp g WHERE
    g.type = a.type
    AND (
        ( g.domain = 'RT::Ticket-Role' AND g.instance = 10 )
        OR ( g.domain = 'RT::Queue-Role' AND g.instance = 3 )
        OR ( g.domain = 'RT::System-Role' AND g.instance = 1 )
    );




On Nov 18, 2007 6:02 AM, Jesse Vincent <[EMAIL PROTECTED]> wrote:
>
>
>
>
> On Sun, Nov 18, 2007 at 04:54:03AM +0300, Ruslan Zakirov wrote:
> > Heya, guys.
> >
> > Finally I found some time to test this problem on mysql 5.0 and even
> > has writen a script to reproduce it, but it showed that mysql 5.0.45
> > has no this bug. My script and doogles helped me to prove that it
> > really works as expected. So I really recommend upgrade to 5.0.45 at
> > least for users of 5.0.x.
> >
>
> that's very cool. Can you publish the script so we can test older
> releases to see what release it was fixed in?
>
> -j
>



-- 
Best regards, Ruslan.
#!/usr/bin/perl

use strict;
use warnings;
use DBI;

my $instances = 10000;

my $dbh = DBI->connect('dbi:mysql:database=test;host=172.16.0.1', 'root', '');
my @schema = (
    'DROP TABLE IF EXISTS acl',
    'DROP TABLE IF EXISTS grp',
    'CREATE TABLE acl(id INT PRIMARY KEY, type VARCHAR(32))',
    'CREATE TABLE grp(id INT PRIMARY KEY AUTO_INCREMENT, type VARCHAR(32), domain VARCHAR(32), instance INT)',
);
$dbh->do($_) foreach @schema;

$dbh->do("INSERT INTO acl VALUES(1, 'Owner')");
$dbh->do("INSERT INTO acl VALUES(2, 'Owner')");
foreach my $type ( qw(Owner Requester Cc AdminCc) ) {
    my $domain = 'RT::Ticket-Role';
    foreach my $instance ( 1 .. $instances ) {
        $dbh->do("INSERT INTO grp(type, domain, instance) VALUES('$type', '$domain', $instance)");
    }
}

my @indexes = (
    'CREATE INDEX grp1 ON grp(type, domain, instance)',
    'CREATE INDEX grp2 ON grp(domain, instance, type)',
);
$dbh->do($_) foreach @indexes;
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch 
today. 
    Email us at [EMAIL PROTECTED] or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to