Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 7 of 7 total |
Slow query |
Sat, Aug 14 2010 6:05 AM | Permanent Link |
Francisco Fernandez NewTRON Informatica | Tim.
I have a table with duplicated rows. To delete duplicates I create an autonumeric field called CLIENTES_ID and execute this SQL instruction: (CODIGO is the field duplicated) DELETE from CLIENTES where CLIENTES_ID > ( Select min(CLIENTES_ID) from CLIENTES Tbl1 where CLIENTES.CODIGO = Tbl1.CODIGO ) This operation takes 1:52 minutes in a table with 100000 rows. Is wrong this instruction? because in another database the same instruction takes one second. Thanks and regards. |
Mon, Aug 16 2010 9:49 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Francisco,
<< have a table with duplicated rows. To delete duplicates I create an autonumeric field called CLIENTES_ID and execute this SQL instruction: (CODIGO is the field duplicated) DELETE from CLIENTES where CLIENTES_ID > ( Select min(CLIENTES_ID) from CLIENTES Tbl1 where CLIENTES.CODIGO = Tbl1.CODIGO ) This operation takes 1:52 minutes in a table with 100000 rows. Is wrong this instruction? because in another database the same instruction takes one second. >> 1:52 sounds about right for 100,000 rows, depending upon the row size. If another database is doing it in one second, I can guarantee that a) it's caching the entire table *prior* to the DELETE and b) it's not writing anything to disk. Is the CODIGO column indexed ? If so, how is the index defined, especially the collation (if CODIGO is a VARCHAR/CHAR) ? -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Aug 17 2010 2:57 AM | Permanent Link |
Francisco Fernandez NewTRON Informatica | Tim.
>>Is the CODIGO column indexed ? If so, how is the index defined, especially >>the collation (if CODIGO is a VARCHAR/CHAR) ? Column CODIGO is indexed COLLATE ESP but I only want to know if this instruction may be improve or are ok. Thanks and regards. |
Mon, Aug 23 2010 7:34 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Franisco,
<< Column CODIGO is indexed COLLATE ESP but I only want to know if this instruction may be improve or are ok. >> Is the CODIGO column also defined with the ESP collation ? -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Aug 23 2010 8:10 AM | Permanent Link |
Francisco Fernandez NewTRON Informatica | Tim.
>>Is the CODIGO column also defined with the ESP collation ? Sure. |
Mon, Aug 23 2010 9:33 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Francisco,
<< Sure. >> Sorry, I don't think I was specific enough. Does the CODIGO column have the exact collation 'ESP', and not 'ESP_CI' or some other collation modifier ? Thanks, -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Aug 24 2010 3:00 AM | Permanent Link |
Francisco Fernandez NewTRON Informatica | Tim.
>>Sorry, I don't think I was specific enough. Does the CODIGO column >>have the exact collation 'ESP', and not 'ESP_CI' or some other collation >>modifier ? Yes, CODIGO column have collation 'ESP' and index have the same collation but don't worry, I hope don't use this instruction many times, only was curiosity because, as I said to you, call my attention that another database spend only one second in this work and I didn't know if I was doing well with EDB because the instruction is the same in two cases. Thanks and regards. |
This web page was last updated on Tuesday, May 7, 2024 at 02:40 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |