Hello,
I have 2 tables: invoices (1M records) and invoice_details (5M records)
I want to select all invoices which containe artiklenr "1234":
SELECT customernr from invoice_details d left join invoices i on i.invoicenr = d.invoicenr where artnr = 1234
This query takes about 3 seconds on a remote computer to fetch 3000 results.
There is an index on invoicenr at both tables. Also artnr is indexed.
If I query only invoice_details (SELECT * from invoice_details where artnr = 1234) then it takes about 0.1 sec.
I tried different joins (left,right, etc...) but nothing helped.
I also copied both tables to a mysql database server and did exact the same query. There it takes about 0.0003s for the results.
Maybe someone has an idea how to speed things up.
Dennis
I have 2 tables: invoices (1M records) and invoice_details (5M records)
I want to select all invoices which containe artiklenr "1234":
SELECT customernr from invoice_details d left join invoices i on i.invoicenr = d.invoicenr where artnr = 1234
This query takes about 3 seconds on a remote computer to fetch 3000 results.
There is an index on invoicenr at both tables. Also artnr is indexed.
If I query only invoice_details (SELECT * from invoice_details where artnr = 1234) then it takes about 0.1 sec.
I tried different joins (left,right, etc...) but nothing helped.
I also copied both tables to a mysql database server and did exact the same query. There it takes about 0.0003s for the results.
Maybe someone has an idea how to speed things up.
Dennis