OT Optimizar query MySql

User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

nageswaragunupudi wrote:
FranciscoA wrote:What do you think about the 1000 records specified?
1000 seems large. But let us give it a try.
Please also let me know if the `codicont` field is numeric or character and what is the size of the field.

Code: Select all

          "CODICONT   VARCHAR(20)   NOT NULL DEFAULT '' COMMENT 'Codigo Contable'," +;
 
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OT Optimizar query MySql

Post by nageswaragunupudi »

Not sure.
Can you still try and see?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OT Optimizar query MySql

Post by nageswaragunupudi »

You said this takes only 3 seconds

Code: Select all

SELECT A.codicont AS codigo, A.nombre AS nombre, B.codicont AS catalogo
FROM facturas A LEFT JOIN catalogo B
ON A.codicont = B.codicont ;
 
If so, you may try this

Code: Select all

SELECT * FROM 
(
SELECT A.codicont AS codigo, A.nombre AS nombre, B.codicont AS catalogo
FROM facturas A LEFT JOIN catalogo B
ON A.codicont = B.codicont ;
) AB
WHERE catalogo IS NULL
 
Please try both approaches
Regards

G. N. Rao.
Hyderabad, India
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

Let me make some changes. I'll back
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

nageswaragunupudi wrote:You said this takes only 3 seconds

Code: Select all

SELECT A.codicont AS codigo, A.nombre AS nombre, B.codicont AS catalogo
FROM facturas A LEFT JOIN catalogo B
ON A.codicont = B.codicont ;
 
If so, you may try this

Code: Select all

SELECT * FROM 
(
SELECT A.codicont AS codigo, A.nombre AS nombre, B.codicont AS catalogo
FROM facturas A LEFT JOIN catalogo B
ON A.codicont = B.codicont ;
) AB
WHERE catalogo IS NULL
 
Please try both approaches

The result is correct but... it took 5 minutes 5 seconds.

I'm using SqlYog for the tests.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

The demo server is now taking 1.56 to deliver the result.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OT Optimizar query MySql

Post by nageswaragunupudi »

FranciscoA wrote:The demo server is now taking 1.56 to deliver the result.
Are you referring to the FWH demo server? Now it took 90 seconds for me.
From your country it may be slower.
But how are you connecting the FWH demo server?
Regards

G. N. Rao.
Hyderabad, India
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

nageswaragunupudi wrote:
FranciscoA wrote:The demo server is now taking 1.56 to deliver the result.
Are you referring to the FWH demo server? Now it took 90 seconds for me.
From your country it may be slower.
But how are you connecting the FWH demo server?
Yes, FWH demo server.
I'am connecting with your code, from FW1709\samples.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OT Optimizar query MySql

Post by nageswaragunupudi »

Are you using 1709 or 1204?
Regards

G. N. Rao.
Hyderabad, India
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

1709
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: OT Optimizar query MySql

Post by nageswaragunupudi »

Please try this approach on your tables and see.
Regards

G. N. Rao.
Hyderabad, India
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

The resulting string of 1000 records exceeds the maximum length for the Group_Concat () function.

I will continue investigating to see if I manage to overcome the 3 seconds that I have achieved so far.

Many thanks for your support.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
xmanuel
Posts: 613
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Contact:

Re: OT Optimizar query MySql

Post by xmanuel »

Hola Francisco...

En principio no tengo intención de hacer HDO para xHarbour.
:(
______________________________________________________________________________
Sevilla - Andalucía
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

Ok.
Gracias Manu.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
User avatar
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: OT Optimizar query MySql

Post by FranciscoA »

Hasta hoy pude retomar esto.
Continuando con las pruebas.

Code: Select all

DROP TABLE IF EXISTS pruebas ;

CREATE TABLE pruebas  
   SELECT * FROM facturas GROUP BY codicont ;

SELECT fechemis,td,numdoc,codicont,nombre FROM pruebas
WHERE codicont NOT IN (SELECT codicont FROM catalogo WHERE nv = 'S') ;
 
TOTAL TIEMPO: 3.132 Secs

Saludos.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
Post Reply