Select in Millions of SQL Server Records

Asked

Viewed 341 times

1

Good morning,

I have a database with more than 11 million records, when I make a select on top of the two tables to bring the records the query takes a lot, I wonder how I could improve these performance...

Currently with this select it brings virtually 11 million Registrations in 1:04s but need to leave faster yet.

SELECT 'SMS'                    as Tipo
      ,convert(date, dataenvio) as Data
      ,descCampanha             as Campanha
      ,1                        as Qtd
  from      tblMensagem t1 with(nolock) 
 inner join tblCampanha t2 with(nolock) on t1.codCampanha = t2.codCampanha
  • That one CONVERT is harming the query, see if you can avoid this. Is there no filter you can apply? The column codCampanha in both tables is indexed?

  • @Lucianoramos Start the optimization by analyzing the plan of execution of the query. It is possible to find possible bottlenecks. Sometimes it’s just a matter of outdated statistics.

  • @Josédiz what I could do to improve?

  • What is the goal ? There is a need to use the 11mi records ?

  • @Motta Yes, on account that will be real team

  • Will you work with the 11 million records? What for? View? Rethink your solution as you’ll clog your connection.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.