Server: Ubuntu 16.04.1
Client: Ubuntu 16.04.1, Ruby 2.3 client (Dalli)
Memcache version: 1.4.25
Config changes:
- Changed bind setting to allow external connections
Client code:
DELIMITER $$ | |
CREATE FUNCTION `haversine` (lat1 DECIMAL(8,6), lng1 DECIMAL(8,6), lat2 DECIMAL(8,6), lng2 DECIMAL(8,6)) RETURNS DECIMAL(8,6) | |
BEGIN | |
DECLARE R INT; | |
DECLARE dLat DECIMAL(30,15); | |
DECLARE dLng DECIMAL(30,15); | |
DECLARE a1 DECIMAL(30,15); | |
DECLARE a2 DECIMAL(30,15); | |
DECLARE a DECIMAL(30,15); | |
DECLARE c DECIMAL(30,15); |
class FacilitiesServicesForm | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
# These are sort of like the has_many relation | |
attr_accessor :facilities_offerred, | |
:services_offerred | |
# | |
# We have something called a PartialCalculator in the code | |
# for calculating some health related parameters. | |
# | |
# The PartialCalculator works like this - | |
# | |
# - take an input hash | |
# - merge the given data with some standard values | |
# - calls a FullCalculator with the values (in the overall method) | |
# |
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
The November 2015 meetup was held at the Postmark office on 21st. Here are some pictures.
The meet-up began with an introductory talk about the host company by Mithin. After that we went into the first talk, Speed up Mongo, by Gaurav Shah. The talk was about various lessons learned about Mongo performance in production. The talk also spawned many minor discussions via which we went into some other nitty-gritties of Mongo-Db. The slides are worth a look if you are planning to use Mongo for a project, and are curious about scaling.
The second talk was on Fraud Detection and Prevention in Ecommerce by Ketan Jain. This talk was about the many techniques that Postmark and similar companies apply to check fraud. An interesting and relatable talk, as many scenarios discussed are applicable in In
EXPLAIN | |
SELECT posts.*, comments.* | |
FROM posts LEFT JOIN comments | |
ON posts.id = comments.post_id; | |
# Before adding indexes | |
QUERY PLAN | |
------------------------------------------------------------------------ | |
Hash Right Join (cost=394.50..2589.00 rows=50000 width=150) |
SELECT posts.*, comments.* | |
FROM posts LEFT JOIN comments | |
ON posts.id = comments.post_id; |