Laravel-Challenge-Movie-Table-Eloquent icon indicating copy to clipboard operation
Laravel-Challenge-Movie-Table-Eloquent copied to clipboard

Improve movie select query.

Open habibmhamadi opened this issue 3 years ago • 9 comments

Laravel Debugbar result:

  • Total queries: 1
  • Models: 0
  • Time: 45 ms
  • Ram: 4 mb

Thank you for the challenge, really enjoyed it.

habibmhamadi avatar Aug 08 '21 11:08 habibmhamadi

I think, that is a fast solution, but you are not using Eloquent anymore

ioanschmitt avatar Aug 09 '21 05:08 ioanschmitt

I tried this and it doesn't seem to work on MySQL?

image

avidianity avatar Aug 09 '21 05:08 avidianity

I think, that is a fast solution, but you are not using Eloquent anymore

Oh, I didn't notice to use eloquent only. I will update it soon.

habibmhamadi avatar Aug 09 '21 06:08 habibmhamadi

I tried this and it doesn't seem to work on MySQL?

image

I am using Postgres, I will update to use eloquent only.

habibmhamadi avatar Aug 09 '21 06:08 habibmhamadi

@ioanschmitt & @avidianity I have updated to use eloquent only.

Result:

  • Queries: 2
  • Models: 110
  • Time: 761 ms
  • Ram: 5 mb

habibmhamadi avatar Aug 09 '21 06:08 habibmhamadi

Good, now we have to wait for the video of Povilas 😄

ioanschmitt avatar Aug 09 '21 07:08 ioanschmitt

Screenshot 2021-08-09 at 1 26 36 PM

SagarNaliyapara avatar Aug 09 '21 07:08 SagarNaliyapara

Screenshot 2021-08-09 at 1 26 36 PM

Yeah, it depends on the host machine. It takes less than 100 ms when I used query builder but I have changed it to use eloquent as the challenge asked.

habibmhamadi avatar Aug 09 '21 08:08 habibmhamadi

@habibmhamadi thanks for being the first, even before the video was released so you found it directly on Github :)

And yes, the condition was Eloquent, so your solution is good, but I'll analyze what others suggested and will discuss everything in the upcoming video.

PovilasKorop avatar Aug 09 '21 12:08 PovilasKorop