The existing answers are great, but I have some things to supplement them...
I defragment my SSD and disable automatic TRIM, but for totally different reasons than mentioned:
I want to be able to recover files or partitions if & when I accidentally delete something.
No, it doesn't happen often, but the few times it's happened, it's been quite frustrating to not be able to recover things that I would have been able to recover on a hard drive, even when I tried to recover them immediately after deletion.
I expand, shrink, and even move partitions around every few months, and defragmenting and consolidating files makes this operation far faster and less risky. You'd think you can trust partition managers nowadays, but as late as December 2015, I've run into errors (corruption) on plain move/resize operations. And the smarter partition managers try to avoid running on volumes that are heavily fragmented before any damage is done (and usually, though not always, succeed).
I use Linux sometimes, and I've gotten burned by its corruption of NTFS volumes as lately as a year or so ago. This isn't due to fragmentation specifically, but seeing that it can't even handle unfragmented files properly, I'm on the defensive and trying to present as clean of a volume as possible to it (and even then, I avoid writes most of the time).
The sad part about #2 and #3 is, people who haven't seen these problems with their own eyes always think I'm nuts and am making this all up, or that my system must be broken somehow. But I've reproduced these quite a few times on multiple systems, and as someone who has written his own NTFS readers, I know a thing or two about file systems and kernel programming... with NTFS being at the center. So I know bugs when I see them. Nobody believes me, but I warn people anyway, given that I've seen these happen with my own eyes -- so, if you mess with partitions or use Linux at all, I recommend you keep your drives defragmented. YMMV.
Oh, and don't forget to run TRIM manually every once in a while when you don't need to recover anything. Although if I'm being honest I have yet to see any benefit from it...
12The advice to "never defragment your SSD" is obsolete and comes from a time when SSDs were slower and had much more limited write endurance than modern SSDs. Modern SSDs tend to be IOPS limited, and defragmented file systems need fewer I/Os. – David Schwartz – 2016-11-28T18:34:05.760
5
To @DavidSchwartz point, the amount of writes/deletes needed to spontaneously kill a modern SSD is ridiculously high. Unless you are processing an extraordinary amount of information your SSD will most likely last longer than many of your other components even if you are performing conventional defrags.
– DanK – 2016-11-28T20:23:05.90330Why would you want to defragment an SSD? The point of defragmentation is to make files be contiguous on the disk, so the read heads don't have to seek all over the place (which takes time, as it involves physical movement) to read the file. I'm no expert, but AFAIK SSDs are solid state and random access. All accesses take the same time, so it shouldn't matter how file blocks are distributed. – jamesqf – 2016-11-30T04:46:30.413
3
Possible duplicate of Why can't you defragment Solid State Drives?
– Raystafarian – 2016-11-30T12:06:39.2373@Raystafarian Yep, this is definitely a duplicate. It's really interesting to see how different the answers to this question are to that one. – Ajedi32 – 2016-11-30T15:08:58.547
6As Ajedi32 notes, the recommendations on the two questions are completely opposite. That should affect the direction of the duplicate. If the recommendations on the other question are now considered wrong, the only way readers landing there will find the answers on this question is if that one is made a duplicate of this one. – fixer1234 – 2016-11-30T19:57:34.303
@fixer1234 I agree, there's just already a bunch of questions pointing to that one, which is why I picked it. – Raystafarian – 2016-12-01T12:56:11.597
3@jamesqf Did you read my comment? You asked a question I already answered -- Modern SSDs are typically IOPS limited. Reading a file that's in four fragments takes at least four IOs. Reading a file that's in one fragment may take only one. – David Schwartz – 2016-12-05T04:53:55.933