Question

I have a scenario where i need to get the unique fields based on the part of a text field. Let's see this example.

select payload from system_metrics where category like "%action_controller%" ;

I will get the data as

 payload                                                                                                                                                                                                                                                                                                                                                                                                           |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ---
:path: /
:method: GET
:params:
  controller: home
  action: index
:db_runtime: 0.507614
:view_runtime: 24.756144
:end_point: HomeController#index
                                                                                                                                                                                                                                                            |
| ---
:path: /api/tags?access_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/tags
:db_runtime: 1.5405440000000001
:view_runtime: 1.4430399999999999
:end_point: Api::V1::TagsController#index
                                                                                                   |
| ---
:path: /api/skills?access_token=313fcd2b3ea05ff4807f848a921d5105&page_no=1&page_size=10
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  page_no: '1'
  page_size: '10'
  format: json
  action: index
  controller: api/v1/skills
:db_runtime: 1.328608
:view_runtime: 1.7736150000000004
:end_point: Api::V1::SkillsController#index
                                               |
| ---
:path: /api/tags?access_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/tags
:db_runtime: 3.4335250000000004
:view_runtime: 1.536743
:end_point: Api::V1::TagsController#index
                                                                                                             |
| ---
:path: /api/users/notifications
:method: GET
:params:
  format: json
  action: notifications
  controller: api/v1/users
:db_runtime: 1.1296910000000002
:view_runtime: 3.0749649999999997
:end_point: Api::V1::UsersController#notifications
                                                                                                                                                                 |
| ---
:path: /api/tags?access_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  access_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/tags
:db_runtime: 0.6034980000000001
:view_runtime: 1.88346
:end_point: Api::V1::TagsController#index
                                                                                                              |
| ---
:path: /api/roles
:method: GET
:params:
  format: json
  action: index
  controller: api/v1/roles
:db_runtime: 1.005604
:view_runtime: 40.49389600000001
:end_point: Api::V1::RolesController#index
                                                                                                                                                                                                          |
| ---
:path: /api/entities?auth_token=313fcd2b3ea05ff4807f848a921d5105
:method: GET
:params:
  auth_token: 313fcd2b3ea05ff4807f848a921d5105
  format: json
  action: index
  controller: api/v1/entities
:db_runtime: 4.905517
:view_runtime: 0.400314
:end_point: Api::V1::EntitiesController#index

payload is having a text on each like this

:path: /
:method: GET
:params:
  controller: home
  action: index
:db_runtime: 0.507614
:view_runtime: 24.756144
:end_point: HomeController#index

I need to get the unique palyload which will have "end_point:" as unique like

HomeController#index is there so i should not repeat for the nxt time...

what is the query for that one ?????????????????????

No correct solution

OTHER TIPS

I donot think its possible. As the data seems a structured way.If the data is similar type or maintaining a proper structure then we can do this.We can not extract the arbitary sub-string from the column data. Read more about sub-string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top