Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

650
Visualizações
Laravel : what is $query->time time unit?

According to the Laravel documentation, it is possible to add a listener that will log all SQL queries, and log the query duration.

    public function boot()
{
    DB::listen(function ($query) {
        // $query->sql
        // $query->bindings
        $query->time
    });
}

My problem is that I don't know the unit of $query->time, and I can't find this information in the documentation. By reproducing the queries in the Mysql cli client it seems that the result returned are in deciseconds which seems very strange. Because of that I think that I misunderstood something and that measured time might not represent what I am expecting (the Mysql time to answer).

What is the unit of this element ? Is there a better Laravel documentation that could explain what is measured ?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

The parameter you get there is of type

Illuminate/Database/Events/QueryExecuted

According to this

https://laravel.com/api/8.x/Illuminate/Database/Events/QueryExecuted.html

the time is "The number of milliseconds it took to execute the query."

over 4 years ago · Santiago Trujillo Relatório

0

it's calculated using the microtime function, what you get is a milliseconds time value

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda