Patrik Ahlström

3.7K posts

Patrik Ahlström banner
Patrik Ahlström

Patrik Ahlström

@tray2_se

Minor Hifi geek, Major IT Geek and music lover. Sporadic blogger about Laravel and Database related topics. @laracasts forum O.G.

Solna Beigetreten Eylül 2013
220 Folgt163 Follower
Patrik Ahlström
Patrik Ahlström@tray2_se·
@MrPunyapal One way around that is to use computed columns. That way you can index that column and get away with filtering on the year alone. Like always it depends on the need.
English
1
0
4
140
Punyapal Shah
Punyapal Shah@MrPunyapal·
Laravel performance tip: Be careful with `whereDate()` on large tables. It looks clean, but it can make your database apply a function to the column, which may stop the index from being used properly. For bigger tables, prefer a range query. Small change. Big difference at scale.
Punyapal Shah tweet media
English
6
8
75
2.5K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@patilvishi Select your gift from the basket. From the basket select your gift. I think the ”natural” flow is how you structure a sentence in you native language. For example in german the verb is the last word in the sentence. Your gift from the basket select.
English
1
0
2
156
Vishwanath Patil
Vishwanath Patil@patilvishi·
Interviewer: Why does SQL start with SELECT instead of FROM? SELECT name FROM users; Wouldn't this be more natural? FROM users SELECT name; 99% of developers write SQL every day but never think about it...
English
15
1
24
7.6K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@Akintola_steve It depends, but I think of ORMs as a way to make the code more readable, and complex queries makes a mess regardless if you use ORM och plain SQL. In such cases I use views, and then I can keep the ORM simple and readable, and tuck the SQL into a migration
English
1
0
0
67
Akintola Steve
Akintola Steve@Akintola_steve·
Raw dogging plain SQL queries directly inside your backend service vs using ORMs, what’s your take? Speaking strictly from a performance and speed perspective, which approach do you prefer and why? Do ORMs introduce unnecessary overhead, or does the maintainability, abstraction, and developer experience they provide outweigh the performance difference? I’m curious to hear how engineers approach this in real-world production systems.
English
31
0
59
6.8K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@ImLunaHey It's a skill to de-technicalize complex things, and it takes a lot of patience to learn it.
English
0
0
2
50
luna
luna@ImLunaHey·
you can really tell when someone's a jr dev when they have no idea how to talk to someone that's at a different skill level than they are.
English
10
0
26
2K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@krunalbuilds Depends on the application, but I would likely do a hybrid. Step 1. Inactivate the user. Step 2. Delete the user after x days.
English
1
0
3
163
KrunalSinh Sisodia
KrunalSinh Sisodia@krunalbuilds·
Senior Backend Interview Question: Two engineers delete a user from the database. Engineer A 👇 DELETE FROM users WHERE id = 1; Engineer B 👇 UPDATE users SET deleted_at = NOW() WHERE id = 1; Engineer A's user is gone forever. Engineer B's user is hidden but recoverable. A week later, a user emails saying they deleted their account by mistake. Engineer A is having a very bad day. Which one would you approve — and why?
KrunalSinh Sisodia tweet media
English
16
3
37
3.6K
Aaron Francis
Aaron Francis@aarondfrancis·
What's a good loop for someone just getting into loops
English
506
33
1.2K
249.1K
Marcel Pociot 🧪
Marcel Pociot 🧪@marcelpociot·
Is anyone else going to Rock am Ring this weekend so we can turn it into Laravel am Ring? 🤘
English
2
1
12
2.3K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@SumitM_X No. Sooner or later your db will be slow due to too much data in the tables.
English
0
0
0
103
SumitM
SumitM@SumitM_X·
Tech Lead tells you: "Never delete data, just add is_deleted = true for all tables." Will you agree?
English
119
7
729
233.9K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@javarevisited Nothing really, other that the formatting and the readability, and IN(1, 2, 3) would have been easier to read.
English
0
0
0
456
Javarevisited
Javarevisited@javarevisited·
Interviewer: What’s the issue with this? SELECT * FROM orders WHERE id = 1 OR id = 2 OR id = 3;
English
12
0
21
9.4K
SumitM
SumitM@SumitM_X·
Tech Lead said : "password is base64 encoded.... its as safe as a turtle in its shell" Do you also feel its safe ?
English
21
0
66
11.3K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@neerajjj6785 Json should almost never be used inside the database. The only reason I see valid for storing it there, is when you receive a big payload from an API and you process it with a schedule job, rather them at once.
English
0
0
0
44
Neeraj
Neeraj@neerajjj6785·
Interviewer: If PostgreSQL supports JSON, why would anyone choose a NoSQL database?
English
48
2
195
33K
Javarevisited
Javarevisited@javarevisited·
Interviewer: Your authentication service is down. Nobody can log in. CEO is messaging every 2 minutes. What do you do first?
English
17
1
32
14.5K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@EOEboh Nope, binary data does not belong in the db, it belongs on the file system.
English
0
0
1
189
Cap-EO 👨🏾‍💻
Cap-EO 👨🏾‍💻@EOEboh·
As a developer, have you ever asked: Why does every major app store images in S3 instead of a database?
English
131
26
1.1K
318.5K
Punyapal Shah
Punyapal Shah@MrPunyapal·
Saying it again: Javascript is not for backend
English
15
1
55
5.4K
Patrik Ahlström
Patrik Ahlström@tray2_se·
@Umesh__digital If you have one key in your pocket, it's fast to get it, if you have 100 keys in your pocket, how long does take to get the correct key?
English
0
0
0
49
Umesh Kumar Yadav
Umesh Kumar Yadav@Umesh__digital·
Interviewer: If cache is faster than DB, why not store everything in cache? 🤔
English
61
7
184
60.2K
Christoph Rumpel 🤠
Christoph Rumpel 🤠@christophrumpel·
Every time I use number inputs, I wonder if I would be better off without a text one. The "Up/Down" buttons are super small, hard to click, increase way too fast and need extra space in the input. Am I the only one?
Christoph Rumpel 🤠 tweet media
English
16
0
35
5.4K
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
UUIDv4 vs UUIDv7 What would you pick for a new system?
English
25
0
85
27.5K