Log message #4199492

# At Username Text
# Aug 22nd 2019, 11:22 alexdd55976 ```$newdata = $query->offset($data['start']) ->limit($length);```
# Aug 22nd 2019, 11:19 alexdd55976 try $this->find()->limit(n)->page(m)
# Aug 22nd 2019, 11:19 alexdd55976 just don'T do this
# Aug 22nd 2019, 11:19 alexdd55976 ´´´$this->paginate = [ 'limit' => 1, 'contain' => [ 'Status', ], ];´´´
# Aug 22nd 2019, 11:18 conehead 3.8.2
# Aug 22nd 2019, 11:18 conehead Or internally
# Aug 22nd 2019, 11:18 alexdd55976 what cake version u use?
# Aug 22nd 2019, 11:17 conehead I do not need the count. When I try to paginate, this count query is executed automatically
# Aug 22nd 2019, 11:16 alexdd55976 for what do you need the count for?
# Aug 22nd 2019, 11:15 alexdd55976 :face_with_monocle:
# Aug 22nd 2019, 11:15 conehead That is exactly what I am trying right now.
# Aug 22nd 2019, 11:14 alexdd55976 and avoids some load on post query pagination
# Aug 22nd 2019, 11:14 alexdd55976 super quick
# Aug 22nd 2019, 11:14 alexdd55976 did you think about datatables, combined with ajax calls and json repsonses?
# Aug 22nd 2019, 11:13 alexdd55976 urgs
# Aug 22nd 2019, 11:13 conehead Right now it would be just way faster to load 20k entries and throw them at the user than trying to paginate haha
# Aug 22nd 2019, 11:11 conehead And until now it actually worked quite well. Absolutely not sure if a combined index is the right thing to use here. Just seemed to make sense here
# Aug 22nd 2019, 11:11 alexdd55976 you don't wanna open this pandoras box
# Aug 22nd 2019, 11:11 alexdd55976 lol.. don't touch that :)
# Aug 22nd 2019, 11:11 alexdd55976 oh, ok
# Aug 22nd 2019, 11:10 conehead Was hoping to switch one day. But as the systems are productive and the ids are stored in thousands of entries and in lots of versioning/history I did not want to switch all
# Aug 22nd 2019, 11:10 alexdd55976 serious question.
# Aug 22nd 2019, 11:10 alexdd55976 you sure that a combined index is the way to go there?
# Aug 22nd 2019, 11:09 alexdd55976 was thinking about uuids .. but seems that uuids would make more sense, if used all over the place and not mixed up
# Aug 22nd 2019, 11:08 alexdd55976 i have a similar approach planed in my new project
# Aug 22nd 2019, 11:07 conehead it is a Unique Index combined with `model` and `foreign_key`
# Aug 22nd 2019, 11:07 alexdd55976 that explains longer response time
# Aug 22nd 2019, 11:06 conehead Status can be linked to different entities. And some entities have a uuid and some have an id
# Aug 22nd 2019, 11:06 alexdd55976 so its a text fulltext index?
# Aug 22nd 2019, 11:06 conehead No, both CHAR(36), but sometimes the CHAR just stores the id
# Aug 22nd 2019, 11:05 alexdd55976 how can you have both? its a different datatype?
# Aug 22nd 2019, 11:05 conehead Which imho should not be a problem
# Aug 22nd 2019, 11:05 alexdd55976 thats a tough one
# Aug 22nd 2019, 11:05 conehead yes
# Aug 22nd 2019, 11:05 alexdd55976 ?
# Aug 22nd 2019, 11:05 alexdd55976 > OR
# Aug 22nd 2019, 11:04 conehead The foreign_key might contain ids or uuids
# Aug 22nd 2019, 11:03 conehead Urgh...I got an idea
# Aug 22nd 2019, 11:03 conehead ``` SELECT ( COUNT(*) ) AS `count` FROM documents Documents LEFT JOIN statuses Status ON ( Documents.id = (Status.foreign_key) ) ```
# Aug 22nd 2019, 11:00 alexdd55976 so whta the current query?
# Aug 22nd 2019, 11:00 conehead @alexdd55976 yes I removed it and still takes 8 seconds.