How to get lost in your own country
Multiple times
Use Google Maps
About me
Veselin Nikolov
@dzver
WordPress.com
About me
Background as MS SQL DBA
Currently trying to keep things simple in a team of 10
Lessons from working on WordPress.com
WordCamp Romania 2014
What happened with the MySQL talk
One month ago
The reception
The questions
How do I make WordPress secure
What are your tips for secure WordPress
How do I chose save plugins and themes
How do you manage to work remotely?
Are there any other Bulgarians at Automattic?
! MySQL
There are no mistakes,only lessons.
... telling stories this time.
Story #1 The ID
7 year old legacy code
Entire table described in the code
We have items with ids 5 and 6. We need to add 7.
The 5 and 6 were repeated 135 times in the code.
Story #1 The ID
One new object
A few helpers
135 removed magic numbers
One changeset
0 unit tests
What could possibly go wrong?
Ups...
(I broke stuff)
Story #1 Lessons
Pleasepleaseplease, no magic numbers
Atomic commits, please!
Long functions are hard to understand
Stats monitoring
Legacy is code for which we don't have tests
Story #2 The Notification
Montreal
1+ million emails
1+ million discount coupons (10-ish previously)
Friday
What could possibly go wrong?
Story #2 The Notification
Queries that work with small tables:SELECT * FROM table
SELECT * FROM table ORDER BY whateverLIMIT 200, 100
Story #2 The Notification
Queries that don't work with large tables:SELECT * FROM table
SELECT * FROM table ORDER BY whateverLIMIT 200000, 100
Story #2 The Notification
Fetching big amounts of data breaks things
Offsetting breaks things
The coupons weren't really used in the past and didn't really work
Repeating millions of anything means a lot of time
Lessons
Launching big things on Friday
Offsets
SELECT * FROM ...WHERE `id` > 1093029ORDER BY `id` LIMIT 20
SELECT `deadline` FROM ...WHERE `date` BETWEEN '2014-06-20' AND ...
Offsets
SELECT * FROM ...WHERE `id` > 1093029ORDER BY `id` LIMIT 20
SELECT `deadline` FROM ...WHERE `date` BETWEEN '2014-06-20' AND ...
Offsets
SELECT * FROM `table` JOIN ( SELECT `id` FROM `table`ORDER BY `whatever`LIMIT 5000,50
) as `b` USING `id`
Story #3 The A/B Test
A/B test is showing different things to users and measuring effect
We use Kissmetrics
We've had 5 different A/B testing classes
Story #3 The A/B Test
Feature-rich classes
Many levels of abstraction
Expressive names
Many filters and actions
What could possibly go wrong?
Story #3 The A/B Test
class Server_Side_Experiment_Visitor extends Server_Side_Experiment_Base {...
Story #3 The A/B Test
Wrong results, no one knows why.
Story #3 The A/B Test
Wrong results, no one knows why.
Story #3 The A/B Test
A new colleague joins and writes this:ab_test('test-teh-button',array('orange','blue',
)
);// return 'orange'
Story #3 Lessons Learned
KISS. Simplest solution worked
Kissmetrics rocks
A/B test everything
Story #4 Barry
howdy hi, did I break anything? your blog looks hacked
Story #4
Unique passwords
2-factor auth
Come to WordCamp Europe and maybe watch Barry live :-)
#praythatbarrycomestowceurope
Summary
KISS. Simple queries. Simple code.
DRY. Repetition fails.
A/B test. Unit test. Test!
Launch your next project on Friday at 7pm.
My name is VeselinI code for food.
Ask me anything!