Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"PROCEDURE ANALYSE" analogues in MySQL 8 and PostgreSQL

In older versions of MySQL there was an option to analyze existing tables:

SELECT * FROM  `table_name` PROCEDURE ANALYSE()

That seemed useful, a developer could analyze existing tables, see recommendations (for example use smallint instead of int) and consider some of them.

In MySQL 8.0 PROCEDURE ANALYSE() was removed. The reason I found:

"Reasoning: it was discussed many times that the PROCEDURE ANALYZE syntax is an anachronism and almost unused non-standard syntax extension".

Is this the only reason or analyzing tables automatically is a bad practice (even as just an additional instrument for analyze)?

Also I can't find any analogue of "Procedure Analyse" in Postgresql.

I know that I can analyze queries, but I suppose that it is useful to analyze table structure to consider it in architecture of new tables.

like image 880
anvlad Avatar asked Dec 04 '18 11:12

anvlad


1 Answers

This feature is gone and no clear successor that I can find is provided or referenced in the documentation. I attempted to email the guy responsible for this, he no longer works at MySQL and his personal email is dead, so maybe his work was cut short. It's a shame they removed PROCEDURE ANALYSE that users relied on without providing a replacement stored procedure that they talked about.

One can analyse tables manually with statements such as:

select MAX(LENGTH(address1)) from places;
select address1 from places where length(address1) > 99;
like image 132
fmalina Avatar answered Nov 15 '22 23:11

fmalina