OT Optimizar query MySql

Re: OT Optimizar query MySql

Postby FranciscoA » Wed Mar 04, 2020 4:53 pm

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  Expand view  RUN
         "CODICONT   VARCHAR(20)   NOT NULL DEFAULT '' COMMENT 'Codigo Contable'," +;
 
Francisco J. Alegría P.
Chinandega, Nicaragua.

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

Re: OT Optimizar query MySql

Postby nageswaragunupudi » Wed Mar 04, 2020 4:57 pm

Not sure.
Can you still try and see?
Regards

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

Re: OT Optimizar query MySql

Postby nageswaragunupudi » Wed Mar 04, 2020 5:03 pm

You said this takes only 3 seconds
Code: Select all  Expand view  RUN

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  Expand view  RUN

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
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: OT Optimizar query MySql

Postby FranciscoA » Wed Mar 04, 2020 5:06 pm

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

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

Re: OT Optimizar query MySql

Postby FranciscoA » Wed Mar 04, 2020 5:23 pm

nageswaragunupudi wrote:You said this takes only 3 seconds
Code: Select all  Expand view  RUN

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  Expand view  RUN

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.

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

Re: OT Optimizar query MySql

Postby FranciscoA » Wed Mar 04, 2020 5:30 pm

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

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

Re: OT Optimizar query MySql

Postby nageswaragunupudi » Wed Mar 04, 2020 5:37 pm

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
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: OT Optimizar query MySql

Postby FranciscoA » Wed Mar 04, 2020 5:48 pm

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.

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

Re: OT Optimizar query MySql

Postby nageswaragunupudi » Wed Mar 04, 2020 6:02 pm

Are you using 1709 or 1204?
Regards

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

Re: OT Optimizar query MySql

Postby FranciscoA » Wed Mar 04, 2020 6:08 pm

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

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

Re: OT Optimizar query MySql

Postby nageswaragunupudi » Wed Mar 04, 2020 6:12 pm

Please try this approach on your tables and see.
Regards

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

Re: OT Optimizar query MySql

Postby FranciscoA » Thu Mar 05, 2020 12:52 am

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.

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

Re: OT Optimizar query MySql

Postby xmanuel » Fri Mar 06, 2020 8:40 pm

Hola Francisco...

En principio no tengo intención de hacer HDO para xHarbour.
:(
______________________________________________________________________________
Sevilla - Andalucía
xmanuel
 
Posts: 762
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla

Re: OT Optimizar query MySql

Postby FranciscoA » Fri Mar 06, 2020 11:23 pm

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

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

Re: OT Optimizar query MySql

Postby FranciscoA » Sun May 03, 2020 3:45 pm

Hasta hoy pude retomar esto.
Continuando con las pruebas.
Code: Select all  Expand view  RUN
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.

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

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 39 guests