[Db] Mysql e Copying to tmp table

Francesco F franco a inpe.unipi.it
Mar 17 Lug 2007 10:12:09 CEST


On 17/07/2007 9.41, Domenico L. wrote:
> lock del disco? hai provato a fare un restart, ad ottimizzare le tabelle 
> ecc.. prova anche a postarci la query incriminata
> 

Avevo già fatto restart e optimize table ma niente!

Questa è la query:
Select  [lista dei campi...]
from FCARTELL
left join prestazioni on (FCARTELL.codpaziente = prestazioni.codpaziente 
and prestazioni.tipopr = 1 and prestazioni.assente = 0 and 
prestazioni.cancellato = 0 and prestazioni.autorizzata = 1 and 
prestazioni.data between FCARTELL.ricovero and if(FCARTELL.dimissione = 
'0000-00-00', concat('" . $par_anno . "', '-12-31'), FCARTELL.dimissione))
left join DIAGNOSI ON(FCARTELL.codpaziente = DIAGNOSI.codpaziente)
left join INTERVENTI ON(FCARTELL.codpaziente = INTERVENTI.codpaziente)
left join tbdiagnosi on (tbdiagnosi.codice = DIAGNOSI.codice and 
FCARTELL.ricovero between tbdiagnosi.data_inizio and tbdiagnosi.data_fine)
left join tbinterventi on (tbinterventi.codice = INTERVENTI.codice and 
FCARTELL.ricovero between tbinterventi.data_inizio and 
tbinterventi.data_fine)
left join tbpersonale on (tbpersonale.id = prestazioni.pers_stampa)
left join FMEDICI on (FMEDICI.id_ = FCARTELL.medico_accettante)
where FCARTELL.anno = XXX and FCARTELL.regresu = 'XXX' and 
FCARTELL.uslresu= 'XXX'
group by FCARTELL.codpaziente
order by FCARTELL.ricovero DESC;

Questi i record per ogni tabella:
FCARTELL	23074
prestazioni 	273000
DIAGNOSI	59267
INTERVENTI	108544
tbdiagnosi	23319
tbinterventi	7124
tbpersonale	177


	Francesco




Maggiori informazioni sulla lista Db