►
From YouTube: Database Office Hours 2019-07-25
Description
0:00 Efficient counters, usage ping, approximate counting, batched counting
2:10 Migrations: Background, post-deploy, regular
A
A
It
is
still
sort
of
an
interesting
topic
because
he
was
pointing
out
that
we
have
this
usage
ping
database
queries
and
they
basically
try
to
count
all
the
stuff
and
that's
increasingly
hard
when
you,
when
you
have
like
big
tables
and
and
for
some
of
those
we
already
use
approximate
counting
and
for
others.
We
still
count
exactly,
and
there
is
a
proposal
for
like
deficient
or
transactional
counters,
but
it's
still
in
the
back
book,
so
I'm
I'm,
not
sure
when
we
are
going
to
see
that
happen.
I.
A
Created
another
issue
that
is
for
a
batch
counting
and
it's
very
fresh
I,
don't
know
I
would
love
to
get
comments
on
that.
That
makes
sense,
but
given
that
the
usage
ping
is
sort
of
a
background
job,
we
can
take
a
lot
of
time
for
counting
that
doesn't
hurt.
It
just
hurts
when
you,
when
you
take
ages
for
one
query
and
if
we
would
instead
just
batch
count,
you
know
count
single
batches
of
10,000
records,
or
so
it
would
take
a
long
time,
but
it
would
actually
finish
because
we
wouldn't
run
into
a
statement.
Timeout.
B
Yes,
so
after
reviewing
some
mutt
repairs,
I
have
some
questions
so
I
have
a
question
regarding
the
migrations
that
are
located
on
their
paws,
migrate,
folder
and
the
migrations
are
advocated
under
them.
Migrate,
folder
like
if
we
have
a
backrub
migration.
Where
should
we
go?
Do
we
have
like
Ana
strict
guideline
regarding
those
or.
B
C
Well,
I
do
have
a
an
example
of
that,
but
I
did
post
it
in
the
post
migration
because
it
just
felt
like
obvious.
For
me:
they
had
a
data.
Migration
should
go
in
there.
They
post
migrate
kind
of
more
of
a
like
I,
don't
know
logically,
but
like
we
deployed
a
fix
and
then
in
the
next
deploy
we
would
do
a
data
migration,
so
that
kind
of
you
can
think
that
the
code
is
already
there
so
in
the
next
deploy.
C
C
A
What
we
sometimes
do
is
when,
when
we
do
those
batch
background
migrations,
where
we
update
records
in
a
batch
fashion,
is
we
basically
have
a
post
migrate
where
you
know
a
regular
migration,
where
we
sort
of
build
up
the
batches
so
that
we
iterate
all
the
batches
that
we
have
and
then
we
schedule
jobs
for
each
of
those
probably
doesn't
take
a
long
time,
but
that
may
also
be
something
that
is
more
heavy
than
like
a
normal
DDL
statement
or
whatever.
Maybe
that's
another
reason
to
put
it
in
a
these.
C
It
sounds
to
me
that
there
is
no
like
strolling
goodness
but,
like
I,
think,
ideally
any
data
migration
should
go
to
me
to
a
post
migrate.
It
sounds
like
so
anything
that
is
schema
related
that
that
obviously
does
need
to
happen
before
code
can
actually
start
working
with
that
data
should
go
into
the
my
create
folder
and
there
pretty
much
everything
else
is
going
to
post
migrate.
That
sounds
like
logical
things
to
me,
but
it
might
might
not
even
be
that
strict
as
well
so
or
not.
D
A
A
Based
on,
like
these
questions,
I
asked
the
delivery
team
Yorick
answered
on
that
one,
whether
or
not
would
make
a
difference,
putting
migrations
and
in
a
regular
one
or
in
the
post,
deploy
for
the
deployment
or,
if
there's
any
preference,
where
we
should
put
them.
If
there's
a
choice-
and
you
pointed
out
that
for
the
deploy
doesn't
really
make
a
difference,
because
you
would,
you
would
have
to
deploy,
takes
as
long
as
it
takes
for
executing
those
it's
just
the
all.
A
C
Also,
another
thing
is
that
you
can
actually
skip
the
post
migrations
right
and
then
you
cannot
skip
the
migration.
So
this
is
why
I
like
it
makes
sense
that
some
data
migration
should
go
into
into
post
migrate,
because
then
you
can
do
a
deployment
and
do
a
code
update
with
just
the
normal
migrations,
and
you
can
just
run
the
data
migration
whenever
your
server
feels
like
handing
the
the
load.
B
So
I
put
the
match
request
on
the
chat,
and
basically
this
is
a
migration
that
is
changing
some
data
on
the
births
table,
but
the
birth
table
only
has
like
100
records
and
they
wanted
to
initially
to
do
a
background
migration
and
for
100
records.
I,
don't
think
that
is
necessary
because
they
update
where
it
would
be
wrote
very,
very
fast,
so
I'm
not
sure
when
we
should
use
background
migrations
like
for
updating
records.
Like
do
we
have
like
a
certain
guideline
like
if
the
table
has
less
than
5,000
records.
B
C
I'm,
not
an
expert
in
any
way,
but
I'd
like
my
thinking,
is
that
we
may
have
some
kind
of
data
in
our
database
and
obviously
get
lappam
is
probably
the
biggest
instance
you
can
have
buddy.
You
can
never
know
like
what
other
customers
are
doing
so
I.
Think,
like
a
good
rule
of
thumb,
is
like
to
actually
just
enforce
to
have
all
of
the
data
migrations.
Perhaps
it
doesn't
take
longer
I
think
even
it's
incude
it'll
like
delay.
What
2
minutes
later
or
something
like
that?
Well
yeah
depends
on
how
big
the
queue
is.
C
C
E
Not
only
faster,
not
only
faster
but
less
fragile,
because
when
you
use
a
radius
sidekick
of
to--for
to
change
something
in
both
keys,
you
need
to
keep
in
mind
that
something
can
happen
on
radius
if,
in
case
of
just
handed
records,
I
would
use
your
simple
one
batch
regular
one
transaction
migration.
But
of
course
we
need
to
be
sure
that
other
installations
have
not
more
than
a
thousand
records.
E
E
So
if
we
update
something,
it's
better
not
to
exceed
one
second,
better,
of
course
last,
but
one
second
is
already
like
if
we
lock
someone
with
our
update
up
to
one
second,
it's
already
noticeable
so
I
would
estimate
when
we
deal
with
account
migrations,
I
would
estimate
using
github.com
data
how
much?
How
long
is
one
batch
processing
and
then
I
would
decide,
but
back
to
background
migrations.
This
is
the
most
like
most
fragile
approach,
because
we
split
two
batches.
We
put
the
two
register,
then
we
rely
on
consumers
and
so
on.
A
I
remember
an
example
where
we
were
actually
shipping
another
round
of
the
same
migration,
but
not
in
a
background
migration,
but
in
a
regular
one
to
make
sure
that
all
those
batches
actually
executed.
So
there's
no
data
left
to
update.
So
that
was
a
bit
odd
too,
because
you
would
do
the
same
thing
over
again
to
make
sure
that
you
know
you
caught
everything
so
yeah
that
that's
a
bit
more
fragile
and
yet
other
person.
A
There
is,
you
can
always
also
consider
doing
batch
updates
in
the
regular
migration
right
so
for
for
the
the
really
huge
background
migrations
that
we
have
we
we
would.
We
would
aim
for
scheduling
a
batch
every
minute
or
so
just
to
keep
the
keep.
The
traffic
on
the
database
load
spread
out
the
load
over
time
and
also
make
sure
that
we
don't
lock
end
up
blocking
too
many
records
for
for
too
long
period
of
time.
A
A
A
A
B
A
E
E
New
tool,
you
can
check
it
right
now.
This
is
a
new
slack
channel
called
database
lab.
Please
welcome
and
see.
There
are
some
issues,
so
this
is
like
production
database
quo
and
you
can
do
anything.
You
want
the
same
way
as
short
hops.
You
can
write
out
there
there
and
you
will
see
comments,
so
you
can
run
updates,
deletes
anything
and
also
create
create
some
indexes
and
so
on,
and
then
this
command
reset.
So
you
can
revert
any
changes
you
did,
but
there
are
two
things
to
like
to
remember.
E
First,
is
it's
right
now
it's
single
node.
So
if
two
people
are
working
as
matthias
lee,
they
can
probably
mix
some
sound
actions
and
it
can
affect
its
proof
of
concept
right
now.
Only
stage
and
another
thing,
these
databases
on
the
first.
There
are
some
issues
with
some
tables.
Like
you
probably
will
see.
If
you
try,
you
will
see
some
I
also
I'm
working
on
it.
Something
goes
wrong,
but
I
will
fix
it.
I
hope
exactly
like
exactly
this
thing
is
needed
to
check
any
type
of
query
on
database.
E
You
will
see
detailed
plan.
Of
course,
timing
may
differ
from
production
because
this
instance
is
smaller,
but
be
wrong
to
this
direction.
Is
okay,
I
mean
if
you,
if
you
see
two
seconds
on
production,
it
will
be
one.
Second,
it's
fine,
and
actually
what
is
most
important,
also
like
amount
of
memory
fact.
So.
E
Time
is
very
what
I
think
depends
on
at
night
at
night
in
Europe.
It
can
be
one
second,
that
day
in
Europe
it
can
several
seconds
on
production
because
there
is
more
busy
buffers
like
it's
very
hard.
I
raise
this
question:
let's
define
numbers
but
actually
like
the
most
stable
thing
is
number
of
buffers.
We
touch
right
so,
but
it's
hard
to
define
rules
based
on
those
numbers,
it's
better
to
define
them
on
seconds,
but
seconds
are
volatile.
So
there
are
like
a
lot
of
moving
things
here,
but
with
defining
some.
D
E
A
Right
they,
what
we
did
previously
was
using
those
one
of
instances
for
getting
getting
a
full
copy
from
production
and
using
that
and
then
throw
it
away,
and
that
suffer
from
the
same
thing.
Where
were
you,
you
have
like
a
different
instance
size,
different
resources,
but
what
was
really
helpful
is
when
you,
when
you
have
things
like
you
know,
you
you
compare
that
to
the
previous
version
of
the
career.
E
C
I
think
even
a
monthly
or
even
bimonthly
should
be
just
fine,
I
guess
like
like
size-wise,
because
it
would
be
different,
then
production
that
have
a
very
very
close
to
what
you
have
on
production.
So
if
we
saw
what
I'm,
what
I'm
trying
here
to
say
is
that,
even
if
it's
not
feasible
to
do
it
weekly
doing
it
monthly,
where
every
couple
months
should
be
just
fine,
I
guess
for
the
engineering
team
to
to
estimate
stuff
yeah.
A
The
other
hand,
when
you
you
know
when
you
deploy
regularly,
you
might
even
not
see
all
of
those
tables
that
have
been
introduced
while,
while
or
since
that
des
natural
was
taken.
So
it
may
complicate
things
when
you
have
to.
You
know
figure
that
out
what
is
what
is
missing
and,
on
the
other
hand,
it
may
be
even
possible
to
just
attach
that
instance
to
to
the
production
archive
and
actually
keep
that
updated
right.
E
E
A
This
is
really
awesome
benefit
from
rap
because
chops.
Today's
is
like
read
only
whenever
you
want
to
you
want
to
create
something
that
doesn't
work.
Well,
that's
really
cool
to
have
when
you
you
create
a
snapshot.
You
just
promote
that
you
have
a
read,
write
copy.
You
can
do
whatever
you
want
and
then
just
reset
that
sort
of
it's
very
nice.
D
C
Agenda
which
is
like
how
can
we
get
some
of
the
access
where
we
can
try
out
stuff
and
then
basically
come
up
with
these
results
post
it
in
the
Mar,
merge
request
where
every
issue
and
get
your
review,
so
that
should
be
much
easier
for
you
guys
to
review
then
go
ahead
and
do
it
all
yourself
for
them
for
us
to
wait
for
the
results.
So
that's
cool.
E
C
A
A
Because
then
you
only
have
to
look
at
a
sequel
and
not
not.
You
know,
check
out
and
figure
out
what
the
active
record
produces
and
what
I
found
really
helpful
is
when
you
provide
an
example
for
the
sequel
before
that
change
best
with
an
execution
plan
and
then
the
same
thing
after
that
change.
So
you
can
really
spot
the
difference
in
both
the
the
query
and
the
plans
and,
in
the
best
case,
we'd
be
using
a
good
example
for
parameter
values.
A
C
Really
good,
isn't,
though,
okay
to
like
paste
the
entire
sequel
in
the
comment,
or
is
it
just
better
to
link
it
to
somewhere
external
I?
Don't
know,
I
feel
like
sometimes
that's
something
like
the
recent
Amar's
that
I'm
working
on
the
sequel
includes
a
couple
Union
statements,
and
then
it
doesn't
update
it's
kind
of
big
and
then,
if
you
want
to
leave
also
some
commands
and
explanations,
it
just
goes
like
it
feels
like
it
never
finishes
or
something
like
that.
So
I'm
not
sure.
C
What's
the
best
approach,
there
is
it
okay,
for
you
guys
is
it
is
it?
Is
it
rather
put
it
into
a
poor
sequel
instance,
and
just
for
some,
some
page
being
save
it
there
and
then
I'm
just
have
the
link
here
and
have
the
commands
like
the
explanation
and
then
do
this
equal
or
maybe
we
do
have
like
this
snippets
or
something
like
that
store
this
equaling,
the
snippet.
A
A
A
D
A
C
Link
here
and
then
I
guess:
I
can
post
it
in
the
document
as
well,
where
you
can
see
like
I'm,
trying
to
post
the
sequel
and
then
the
query
plan
and
then
the
new
sequel
and
then
the
query
plan,
and
just
it
just
drags
on
and
on
and
on
and
on,
and
it's
like
for
me
personally,
it's
kind
of
well.
When
does
this
stop
and
wonder,
I've
read
what
this
guy
wants.
Actually,
sir.
D
C
D
C
That's
a
another
request
for
the
plan
team
to
make
sure
you
can
collapse
the.
How
do
you
call
this?
The
when
you
include
some
the
code
sections
within
a
comment
or
something
like
that?
That
probably
could
be
very,
very
helpful
because
sometimes,
like
these
kind
of
code,
snippets
can
get
long.
So
then
you
can
shrink
them
and
read
the
comments
in
that
expand.
C
I
think
that
would
be
very
helpful.
Okay,
they
in
the
documentation
that
you've
just
updated
recently
for
the
DB
review,
and
not
only
for
the
developer
site
when
they
do
ask
for
review
to
just
ask
them
to
put
in
the
generated
sequel
rather
than
for
you
guys
to
go
into
the
code
and
generate
the
sequel
yourself.
You
don't
revive
the
sequel
and
they
explain
form
so
that
I
guess
that'll
be
helpful
for
the
developers
as
well
to
know
what
you
do.
B
A
Think
where
this
came
from
was
just
to
thinking
that
we
should
disallow
adding
columns
without
a
limit,
because
that
opens
up
for
abuse,
or
it
also
means
we're
not
really
sure
how
much
data
we
probably
going
to
put
in
there.
So
just
having
a
ruby
cup
that
would
detect
that
I'm
sort
of
complain
when
there
is
no
limit,
would
already
sort
of
help
to
spark
a
conversation
about
putting
a
specific
limit
in
there.
A
I
thought
about
the
about
putting
a
standard
limit
in
there
a
bit
first
I
thought
it
was
hard,
because
what
are
you
going
to
put
in
there?
But
on
the
other
hand,
if
we
made
it
if
we
made
a
default
limit
of
like
200
characters,
that
would
also
help.
But
it
is
aggressive
because
you
don't
you
can
put
like
really
a
lot
of
data
in
there
and
when
you
actually
need
that,
when
your
use
case
asks
for
that,
you
can.
You
can
always
say,
like
we
allow.
C
Yeah,
it's
hard
to
know
sometimes
like
if
you
can
have
a
title
where
you
can
have
a
URL
or
you
can
have
a
I.
Don't
know
they
shy
D
so
that
that
they
did.
The
limit
really
differs
a
lot
for
different
cases,
but
just
making
sure
that
the
developer
or
whoever
is
designing.
Anything
is
aware
that
the
needs
to
be
a
limit
and
then
they'll
have
titty
they'll
need
to
think
about
it
like
and
impose
something,
a
nanny
trade
on
that
and
increase
it
or
decrease
it.
A
F
A
E
E
A
A
F
C
C
A
E
E
E
A
B
A
B
So
I
put
together
some
numbers
about
their
database
review
workload
for
the
last
milestone
and
I
did
it
because
last
week,
which
was
officially
the
last
week
to
shape
things
for
the
milestone,
it
was
a
bit
crazy
to
get
all
review
stones
because
basically
my
email
exploded
and
my
mentions
exploded
and
I
was
like
okay.
This
is
not.
This
is
not
going
to
scale
very
well,
so
I
just
wanted
to
give
an
insight
of
the
work
that
we
are
doing.
B
B
But
what
scares
me
ovide
is
the
average
of
merge
request
that
each
that
each
reviewer
has
to
review,
which
is
30
and
30
if
a
lot
and
the
average
time
it
took
to
approve
their
database
from
the
Marshall
quest
from
Adam
is
perspective,
which
is
8
days,
and
this
is
the
time
that
I
am
measuring
this
time.
From
the
moment,
someone
adds
the
database
label
until
the
moment.
A
Agree
it's
but
it's
great
seeing
those
numbers,
it's
very
useful,
also
to
see
that
per
release,
and
hopefully
those
those
numbers
are
going
to
go
down.
I
was
wondering
about
the
about
the
time
to
review
a
bit
because
we
started
to
do
was
using
those
scoped
labels.
For
you
know
the
review
itself
in
addition
to
the
database
level,
so
I
would
expect.
There
is
quite
a
few
MRIs
out
there
where
you,
you
put
the
database
level
from
the
start,
but
you
would
only
request
the
review
at
some
point
later.
D
B
B
B
F
C
Okay,
I'm
going
to
sauna
I
think
we
are
over
at
the
time,
but
today
I
learned
a
lot,
especially
about
the
database
lab.
So
thanks
a
lot
a
lot,
a
lot
one
more
time
and
everyone
else
for
the
work
have
a
nice
day.
Yeah
I'll
give
you
some
feedback,
I.
Guess
these
days,
I'm
going
to
try
it
out
the
updates,
hopefully
not
the
job
statements,
but
you
know
all
right.
You
too.
D
F
A
A
A
D
F
A
D
A
Yeah
and
if
those
are
not
heavier
than
and
they
get
the
lock
immediately,
then
that
is
going
to
be
quick
as
well
like
for
even
for
600
records.
That's
not
going
to
take
forever,
but
if
it
was
a
case
where
the
update
itself
was
maybe
a
calculated
one
that
would
take
a
while
to
run
them
may
be
different.
A
But
it's
it's
hard
to
tell.
It
was
just
a
general
concern
to
look
out
for
I
think
when
you,
when
you
run
single
record
updates
that
is
sort
of
the
most
in
efficient
way
of
doing,
updates
and
also
takes
maybe
the
most
time
to
do
them
and
then,
when
you
wrap
them
into
a
transaction,
just
I
would
just
think
about
what
the
what
the
impact
of
that
is.
But
it
really
sounds
like
it.
There
is
not
a
problem
there.