4

I have a INSERT query and expected 400k rows to be inserted.

But after execution I have 257k inserted.

My expectation from this query

SELECT count(*) FROM daily_checkups WHERE pig_migration_count = 0

result is 400k

Can somebody explain me, why after insert I have less rows?

insert(<<-SQL.squish)
  INSERT INTO pig_migrations (daily_checkup_id, created_at, updated_at, migration_type, amount)
  (
    SELECT id, created_at, updated_at, 4 as migration_type, 0 as amount
    FROM daily_checkups WHERE pig_migration_count = 0
  )
SQL
a.kozubenko
  • 1,030
  • 3
  • 15
  • 24

0 Answers0