use market_data;


PURGE BINARY LOGS TO 'mysql-bin.010';
PURGE BINARY LOGS BEFORE '2019-04-02 22:46:26';

The BEFORE variant's datetime_expr argument should evaluate to a DATETIME value (a value in 'YYYY-MM-DD hh:mm:ss' format).

This statement is safe to run while slaves are replicating. You need not stop them. If you have an active slave that currently is reading one of the log files 
you are trying to delete, this statement does not delete the log file that is in use or any log files later than that one, but it deletes any earlier log files. 
A warning message is issued in this situation. However, if a slave is not connected and you happen to purge one of the log files it has yet to read, the slave 
will be unable to replicate after it reconnects.

To safely purge binary log files, follow this procedure:
On each slave server, use SHOW SLAVE STATUS to check which log file it is reading.
Obtain a listing of the binary log files on the master server with SHOW BINARY LOGS. 

    
    
15.2.GB    

OPTIMIZE NO_WRITE_TO_BINLOG TABLE analystpricetarget;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE analystratings;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE balancesheet;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE incomestatement;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE cashflowstatement;
OPTIMIZE NO_WRITE_TO_BINLOG TABLE dividendhistory;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE etfholdings;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE fundamentals;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE historical;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE insidertransaction;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE options;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE prices;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE secfilings;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE valuations;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE yieldcurve;


use market_data;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE accounts;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE cash;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE trades;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE watchlist;

OPTIMIZE NO_WRITE_TO_BINLOG TABLE watchlists;
