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/>
Something like this will do the trick:

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

```

If you are sure that the hierarchy of your JSON will remain the same, then there is no need to iterate in the json properties by using `(key, value) in data`.

[Updated fiddle](https://jsfiddle.net/0gucxcq2/).