1k rows in first load

There are more than 10m data.
I takes a longtime for the list to first load.
How can i make sure that the 1k rows are chosen randomlt in the first load.

Can you help me with this?
Which of the following codes should I place where?


function index(Request $request, $fieldname = null , $fieldvalue = null){
$view = “pages.urunler.list”;
$query = Urunler::query();
$limit = $request->limit ?? 20;
$search = trim($request->search);
Urunler::search($query, $search); // search table records
if ($request->ajax()) {
$view = “pages.urunler.search”; // use search component for dropdown search
$orderby = $request->orderby ?? “urunler.id”;
$ordertype = $request->ordertype ?? “desc”;
$query->orderBy($orderby, $ordertype);
$query->where($fieldname , $fieldvalue); //filter by a table field
$records = $query->paginate($limit, Urunler::listFields());
return $this->renderView($view, compact(“records”)); }

@cemal please replace 20 here

with 1000.

the data limit per pagination that this does
1000 instead of 20

Is that not what you want?

i want to limit total data on first load
Like this
Select * from urunler where 1 limit 1000

And that is the solution i provided for you above.

still fetches all the records

Hi @cemal, that is a 1000 record that has been fetched, when you click next, it fetches the next 1000 record, and so on. It shows you the total record in your database and the amount that has been fetched. Please note that it is working properly, thanks.

You can equally change the RecordLimit from the app interface.