Skip to content

Commit f524638

Browse files
Optimize Handler_read_rnd by removing ORDER BY clause (#448)
* fix: remove order by clause to prevent increasing handler_read_rnd * fix: add sort by ordinal_position outside of query exectuion --------- Co-authored-by: davinc71998 <[email protected]>
1 parent 6801e69 commit f524638

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pymysqlreplication/binlogstream.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,8 @@ def __get_table_information(self, schema, table):
651651
information_schema.columns
652652
WHERE
653653
table_schema = %s AND table_name = %s
654-
ORDER BY ORDINAL_POSITION
655654
""", (schema, table))
656-
result = cur.fetchall()
655+
result = sorted(cur.fetchall(), key=lambda x: x['ORDINAL_POSITION'])
657656
cur.close()
658657

659658
return result

0 commit comments

Comments
 (0)