hi,
don't listen to last email.

since the two first rows are unique, you can't use my example.

Just create an index as i said, and play your query :
Select BrgId, Kode, Barang From Barang Where Barang in
 (Select Barang From Barang  Group By Barang Having Count(*) > 1 )

Mathias

Selon [EMAIL PROTECTED]:

> I rerezad you and discovered that (BrgId, Kode) is UNIQUE.
> your query will return no rows :o)
>
> spending 54813 ms for nothing.
>
> Mathias
>
> Selon [EMAIL PROTECTED]:
>
> > Hi,
> > You may have the same table structure in MS, but not the same table
> definiton
> > :
> > constraints+indexes+stats !
> >
> > try :
> > create index toto on Barang(BrgId, Kode, Barang);
> > Select BrgId, Kode, Barang From Barang
> >   Group By Barang
> >   Having Count(*) > 1 ;
> >
> > Mathias
> >
> > Selon Hendro Suryawan <[EMAIL PROTECTED]>:
> >
> > > Hi,
> > > I have 8414 records in table name Barang, I run query like this :
> > >
> > > Select BrgId, Kode, Barang From Barang Where Barang in
> > > (Select Barang From Barang  Group By Barang Having Count(*) > 1 )
> > >
> > >  and the answer took 54813 ms. I think is too long. I ran the same query
> > > against same table in MS SQL Server it took 1 second. Does anyone have
> > > any idea?
> > >
> > > I have mysql on FC 3 X86_64 on Athlon 64, RAM 512 MB.
> > > Table Definition :
> > > CREATE TABLE `Barang` (
> > >   `BrgId` int(4) NOT NULL default '0',
> > >   `Kode` varchar(11) NOT NULL default '',
> > >   `Barang` varchar(70) NOT NULL default '',
> > >   `Satuan` varchar(10) default NULL,
> > >   `Stok` decimal(10,0) default NULL,
> > >   `Nilai` decimal(10,0) default NULL,
> > >   `Lokal` char(1) default NULL,
> > >   `SGrupId` int(10) NOT NULL default '0',
> > >   `StokMin` int(10) default NULL,
> > >   `Catatan` blob,
> > >   `Benda` char(1) NOT NULL default '',
> > >   `Gambar` longblob,
> > >   `LastTrans` date default NULL,
> > >   `Operators` varchar(50) default NULL,
> > >   PRIMARY KEY  (`BrgId`),
> > >   UNIQUE KEY `Kode` (`Kode`),
> > >   KEY `Barang` (`Barang`)
> > > ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
> > >
> > >
> > > thanks,
> > > Hendro
> > >
> > >
> > > --
> > > MySQL General Mailing List
> > > For list archives: http://lists.mysql.com/mysql
> > > To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to