Question: We have a requirement, that we want to select k random rows from a database.
So, our intial thought was going like this :-

```
table.objects.filter(..).order_by('?')[:k]

```

but then we read over the internet that this is highly inefficient solution so we came up with this (not so innovative):-

```
random.sample(table.objects.filter(..), k)

```

But this seems to be more slower than previous.

So, we want to know what is correct approach for selection exactly *k* rows from the database, which in our case is postgres.

Answer: 
You can do it like this:

```
<tr ng-repeat="(key, value) in data.Test">
  <td> {{value.Testing.static.name}} </td>
</tr>

```

<https://jsfiddle.net/nh5zxoka/3/>
```js
var myApp = angular.module('myApp',[]);

function MyCtrl($scope) {
    $scope.data = {
 "Test": [{
  "Testing": {
   "static": {
    "name": "test01"
   },
   "testboolean": true
  }
 }, {
  "Testing": {
   "static": {
    "name": "test02"
   },
   "secondstatic": "yes"
  }
 }, {
  "Testing": {
   "static": {
    "name": "test03"
   }
  }
 }]
};

};
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyCtrl">

 <table>
   <tr ng-repeat="d in data.Test">
      <td> {{d.Testing.static.name}} </td> 
    </tr>
  </table>
</div>
```