dimanche 27 août 2017

MySQL Pagination with Randomness

I'm tryin to achieve some pagination with random ordering of the items. I've got a solution and i want an expert advice if its ok or not.

My table loos like:

id | category | product_name | product_description | product_image | filter1 | filter2 | filter 3 .. bla bla bla

And i want to paginate search results based on some filters and randomize the results.

I thinked that i should make another table where i keep only the id of the product, the category and filters with indexeses for all posibilities of filtering. Then, when a search occurs, i search trough the smaller table based on some specific index and keep the ids in an array and randomize them in PHP.

It will be slow?




Aucun commentaire:

Enregistrer un commentaire