insert into table

From: Yambu <hyambu(at)gmail(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: insert into table
Date: 2021-05-29 04:22:02
Message-ID: CALhHtcAEh82EYxvHVenoaCySidM7UM1Jnm0p1WQr7hgROtjpXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

hi

may i know why the below mysql is not inserting into table analyze_checks

insert into analyze_checks(dbname,table_name,frag_ratio,
days,needs_optimization,needs_analyzing )
(select
'test' as dbname,
table_name,
frag_ratio,
days,
needs_optimization,
needs_analyzing
from
(select
table_name,
cast(frag_ratio as decimal(5,2)) as frag_ratio,
days,
case when frag_ratio > 1 then 'Yes' else 'No' end as needs_optimization,
case when days > -1 then 'Yes' else 'No' end as needs_analyzing
from (
select
t.ENGINE,
concat(t.TABLE_SCHEMA, '.', t.TABLE_NAME) as table_name,
round(t.DATA_FREE/1024/1024, 2) as data_free,
(t.data_free/(t.index_length+t.data_length)) as frag_ratio,
datediff(now(), last_update) as days
FROM information_schema.tables t
left join mysql.innodb_table_stats s on t.table_name=s.table_name
WHERE DATA_FREE > 0 ORDER BY frag_ratio DESC )d ) d
where needs_optimization='Yes' or needs_analyzing='Yes');

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2021-05-29 04:24:30 Re: insert into table
Previous Message Nikhil Shetty 2021-05-28 16:31:48 Re: Upgrading password encryption from md5 to scram-sh-256