mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: do not order by default, ordering is slow; also fix a bug for tables without defined primary keys
This commit is contained in:
@ -272,13 +272,12 @@ pub fn orm_select_gen(orm SelectConfig, para string, num bool, qm string, start_
|
||||
}
|
||||
}
|
||||
|
||||
str += ' ORDER BY '
|
||||
// NB: do not order, if the user did not want it explicitly,
|
||||
// ordering is *slow*, especially if there are no indexes!
|
||||
if orm.has_order {
|
||||
str += ' ORDER BY '
|
||||
str += '$para$orm.order$para '
|
||||
str += orm.order_type.to_str()
|
||||
} else {
|
||||
str += '$para$orm.primary$para '
|
||||
str += orm.order_type.to_str()
|
||||
}
|
||||
|
||||
if orm.has_limit {
|
||||
|
Reference in New Issue
Block a user