What is the difference between SELECT * AND SELECT field1,...?

Asked

Viewed 201 times

1

If I need all fields in the table, there is a difference in performance between using the joker "*" (SELECT * FROM ...) and specify all fields in the table (SELECT campo1, campo2... FROM ...)?

Beyond performance, what is good practice?

  • 1

    The answer is already here: https://answall.com/questions/232219/m%C3%A9all-individual-or-parameter-in-query-mysql

  • 1

    @Diegomarques Check my reply on the link that 13dev posted. It takes care of exactly that.

  • My doubt is restricted exactly in the situation of the need to bring all fields of the table, from what I understood in this answer, is for when I will need only a few fields, so I specify them.

  • 3
  • this @rray mentioned covers everything you need

  • depends also on how your application treats "all fields" if it is automatic you can use * but if you have to have some maintenance if any new field is create better list fields

Show 1 more comment
No answers

Browser other questions tagged

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