Re: Sub Query to long...[solved]

2005-05-25 Thread Hendro Suryawan
[EMAIL PROTECTED] wrote: My suggestion: Don't use a subquery, use a temp table ( http://dev.mysql.com/doc/mysql/en/rewriting-subqueries.html) CREATE TEMPORARY TABLE tmpDupes (KEY (`Barang`)) SELECT `Barang` FROM Barang GROUP BY Barang HAVING count(1) >1; Select b.`BrgId`, b.`Kode`, b.`Barang`

Re: Sub Query to long...

2005-05-25 Thread SGreen
Hendro Suryawan <[EMAIL PROTECTED]> wrote on 05/25/2005 06:23:52 PM: > Hi Mathias, > Thanks for your suggestion, but i run this query to find multiple > records with the same name in field barang (double records). And the > results i found 94 rows at 54813 ms. I try your idea and the result is

Re: Sub Query to long...

2005-05-25 Thread Hendro Suryawan
Hi Mathias, Thanks for your suggestion, but i run this query to find multiple records with the same name in field barang (double records). And the results i found 94 rows at 54813 ms. I try your idea and the result is the same. So i think mysql not optimized for this kind sub query. Do you hav

Re: Sub Query to long...

2005-05-24 Thread mfatene
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 PRO

Re: Sub Query to long...

2005-05-24 Thread mfatene
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 : > creat

Re: Sub Query to long...

2005-05-24 Thread mfatene
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

Sub Query to long...

2005-05-24 Thread Hendro Suryawan
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 Ser