Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Ottimizzazione Select

  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2009
    Messaggi
    32

    Ottimizzazione Select

    Come faccio ad ottimizzare questa select eliminando gli NOT EXISTS


    select count(*),(select Immat from RIGA..Vehicule where IdVehicule=dv.IdVehicule) as targa,IdVehicule
    from SPEITA..DestinationVehicule dv
    where CodeTypeDestination ='LOG' and convert(datetime,DateFin,103) >'01/07/2010'
    and not exists (select 1 from SPEITA..DestinationVehicule d2 where d2.IdVehicule=dv.IdVehicule and CodeTypeDestination<>'LOG')
    and not exists (select 1 from SPEITA..DestinationVehicule d2 where d2.IdVehicule=dv.IdVehicule and DateFin is null )
    group by IdVehicule
    having count(*)=1

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    363
    Ma perchè eliminando i NOT EXISTS si dovrebbe ottimizzare ???
    Hai provato a vedere l'Execution Plan della query ???

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.