V
V
vacoo2020-02-17 06:34:32
PostgreSQL
vacoo, 2020-02-17 06:34:32

What is the best way to store completed queries from postgresql?

I have many tables in postgresql. And I get the following json responses from the API (nested objects in each other) at the output.
And this data is requested with high frequency. The database, despite the indexes, cannot cope with the load. Therefore, the idea came up to store a solution like MongoDB in NOSQL, and moreover, this data should be filtered, sorted, and so on. What is the best solution? I'm looking at Apache Solr and MongoDB for now.

ps: I'm still new to highload systems.

[
            {
                "id": 222,
                "status": 3,
                "client_id": 9,
                "client": {
                    "id": 0,
                    "role": "",
                    "mode": "",
                    "login": "",
                    "firstname": "",
                    "surname": "",
                    "sex": "",
                    "photo": "",
                    "photo_url": "",
                    "car_brand": "",
                    "car_model": "",
                    "car_number": "",
                    "car_year": 0,
                    "car_color": "",
                    "car_photo": "",
                    "car_photo_url": "",
                    "created_at": 0,
                    "born_date": "",
                    "city_id": 0,
                    "city": {
                        "id": 0,
                        "name": "",
                        "name_full": ""
                    },
                    "ban": false,
                    "subscription": false,
                    "raiting": 0,
                    "balance": 0,
                    "delay": 0,
                    "delay_fixed": false,
                    "is_checked": false
                },
                "driver_id": 1,
                "driver": {
                    "id": 0,
                    "role": "",
                    "mode": "",
                    "login": "",
                    "firstname": "",
                    "surname": "",
                    "sex": "",
                    "photo": "",
                    "photo_url": "",
                    "car_brand": "",
                    "car_model": "",
                    "car_number": "",
                    "car_year": 0,
                    "car_color": "",
                    "car_photo": "",
                    "car_photo_url": "",
                    "created_at": 0,
                    "born_date": "",
                    "city_id": 0,
                    "city": {
                        "id": 0,
                        "name": "",
                        "name_full": ""
                    },
                    "ban": false,
                    "subscription": false,
                    "raiting": 0,
                    "balance": 0,
                    "delay": 0,
                    "delay_fixed": false,
                    "is_checked": false
                },
                "city_id": 1000,
                "city": {
                    "id": 0,
                    "name": "",
                    "name_full": ""
                },
                "created_at": 1581226919,
                "in_way_at": 1581226959,
                "arrived_at": 1581226989,
                "completed_at": 1581227021,
                "sum": 150,
                "countdown": 300,
                "address_from": "Пищера",
                "address_to": "Таверна",
                "extra": "",
                "mobile_pay": false,
                "arrived": true,
                "leaving": true,
                "ride": 2,
                "reason": ""
            },
            {
                "id": 220,
                "status": 3,
                "client_id": 9,
                "client": {
                    "id": 0,
                    "role": "",
                    "mode": "",
                    "login": "",
                    "firstname": "",
                    "surname": "",
                    "sex": "",
                    "photo": "",
                    "photo_url": "",
                    "car_brand": "",
                    "car_model": "",
                    "car_number": "",
                    "car_year": 0,
                    "car_color": "",
                    "car_photo": "",
                    "car_photo_url": "",
                    "created_at": 0,
                    "born_date": "",
                    "city_id": 0,
                    "city": {
                        "id": 0,
                        "name": "",
                        "name_full": ""
                    },
                    "ban": false,
                    "subscription": false,
                    "raiting": 0,
                    "balance": 0,
                    "delay": 0,
                    "delay_fixed": false,
                    "is_checked": false
                },
                "driver_id": 1,
                "driver": {
                    "id": 0,
                    "role": "",
                    "mode": "",
                    "login": "",
                    "firstname": "",
                    "surname": "",
                    "sex": "",
                    "photo": "",
                    "photo_url": "",
                    "car_brand": "",
                    "car_model": "",
                    "car_number": "",
                    "car_year": 0,
                    "car_color": "",
                    "car_photo": "",
                    "car_photo_url": "",
                    "created_at": 0,
                    "born_date": "",
                    "city_id": 0,
                    "city": {
                        "id": 0,
                        "name": "",
                        "name_full": ""
                    },
                    "ban": false,
                    "subscription": false,
                    "raiting": 0,
                    "balance": 0,
                    "delay": 0,
                    "delay_fixed": false,
                    "is_checked": false
                },
                "city_id": 1,
                "city": {
                    "id": 0,
                    "name": "",
                    "name_full": ""
                },
                "created_at": 1580476031,
                "in_way_at": 1580476419,
                "arrived_at": 1580476421,
                "completed_at": 1580476452,
                "sum": 100,
                "countdown": 180,
                "address_from": "Поликлиника2",
                "address_to": "Героя Попова, 61 к4",
                "extra": "",
                "mobile_pay": false,
                "arrived": true,
                "leaving": false,
                "ride": 1,
                "reason": ""
            },
            {
                "id": 218,
                "status": 3,
                "client_id": 2,
                "client": {
                    "id": 0,
                    "role": "",
                    "mode": "",
                    "login": "",
                    "firstname": "",
                    "surname": "",
                    "sex": "",
                    "photo": "",
                    "photo_url": "",
                    "car_brand": "",
                    "car_model": "",
                    "car_number": "",
                    "car_year": 0,
                    "car_color": "",
                    "car_photo": "",
                    "car_photo_url": "",
                    "created_at": 0,
                    "born_date": "",
                    "city_id": 0,
                    "city": {
                        "id": 0,
                        "name": "",
                        "name_full": ""
                    },
                    "ban": false,
                    "subscription": false,
                    "raiting": 0,
                    "balance": 0,
                    "delay": 0,
                    "delay_fixed": false,
                    "is_checked": false
                },
                "driver_id": 1,
                "driver": {
                    "id": 0,
                    "role": "",
                    "mode": "",
                    "login": "",
                    "firstname": "",
                    "surname": "",
                    "sex": "",
                    "photo": "",
                    "photo_url": "",
                    "car_brand": "",
                    "car_model": "",
                    "car_number": "",
                    "car_year": 0,
                    "car_color": "",
                    "car_photo": "",
                    "car_photo_url": "",
                    "created_at": 0,
                    "born_date": "",
                    "city_id": 0,
                    "city": {
                        "id": 0,
                        "name": "",
                        "name_full": ""
                    },
                    "ban": false,
                    "subscription": false,
                    "raiting": 0,
                    "balance": 0,
                    "delay": 0,
                    "delay_fixed": false,
                    "is_checked": false
                },
                "city_id": 1,
                "city": {
                    "id": 0,
                    "name": "",
                    "name_full": ""
                },
                "created_at": 1580472226,
                "in_way_at": 1580472296,
                "arrived_at": 1580475761,
                "completed_at": 1580475981,
                "sum": 100,
                "countdown": 180,
                "address_from": "Поликлиника",
                "address_to": "Героя Попова, 61 к4",
                "extra": "",
                "mobile_pay": false,
                "arrived": true,
                "leaving": false,
                "ride": 1,
                "reason": ""
            },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2020-02-17
@xmoonlight

Redis and optimize your database structure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question