You're doing get() so your controller fetching all the data first and then sending the data into yajra/datatable on frontend.
you can do it like this(enable paging:true in dt on frontend):
$model = ModelName::query();
$dt = new DataTables();
return $dt->eloquent($model)->toJson();
paging:true fetches only data to be displayed on datatable pagination. Do it like this for using db facades:
$users = DB::table('tableName');
$dt = new DataTables();
return $dt->query($users)->toJson(); //datatables will do the rest