I have taken an example of a people register with the following structure:
I'mtryingtomakeaSELECT
intblPessoa
withJOIN
withtheintentionthatselectreturnsthedataofthetableinwhichtheIdexists,selectselect:
selecttblPessoaJuridica.Nomeas[NomePJ],tblPessoaFisica.Nomeas[NomePF],tblPessoaProdutor.Nomeas[NomeProdutor]fromtblPessoaleftjointblPessoaFisicaontblPessoaFisica.IdPessoaFisica=tblPessoa.idPessoaleftjointblPessoaJuridicaontblPessoaJuridica.IdPessoaJuridica=tblPessoa.idPessoaleftjointblPessoaProdutorontblPessoaProdutor.IdPessoaProdutor=tblPessoa.idPessoawhereidPessoa=2547
ButIhavereadthattheleftjoinisslow,eg:
Slow query in SQL Server with left join
Left Joins are what I want but they are very slow?
among others.
What would be the most efficient way to replace this left join?
EDIT
I put 'NAME' just for example, the PJ has Social Reason, the PF has the Name and the Producer has the name of the Farm / Site / Etc. This diagram is an example I took.