Bug #69163 Mysqldump: option for limit and for reverse sorting

Submitted: 7 May 2013 10:39 Modified: 7 May 2013 10:47
Reporter: Marco Gergele Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S4 (Feature request)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[7 May 2013 10:39] Marco Gergele
Description:
mysqldump can sort by primary key, but only ascending.

mysqldump can not limit the number of rows.

I have added two options: 

--order-by-primary-desc 
                      Sorts descending each table's rows by primary key, or
                      first unique key, if such a key exists.  Useful when
                      dumping a MyISAM table to be loaded into an InnoDB table,
                      but will make the dump itself take considerably longer.

--limit[=name]      (numeric!) Number of rows of each table to dump, 0=all
                     rows

I do need the number for "limit" as a string, so I try to avoid converting it into numbers and back into string.

How to repeat:
mysqldump --order-by-primary sorts ascending, there is no option for descending sort.

Suggested fix:
Patch posted at internals.mysql.com 2013-05-05
[7 May 2013 10:40] Marco Gergele
Patch for mysqldump.c

Attachment: mydump.diff.txt (text/plain), 4.90 KiB.

[7 May 2013 10:47] Sveta Smirnova
Thank you for the reasonable feature request.
[26 Feb 2015 21:45] SIARHEI MM
Can anyone implement this?

It is really good request. Sometimes it is needed to dump database with tables without primary keys. Dump last N records from tables without PK is a good idea.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.