-
데이터 조회 속도 개선 > part.1 DB■ Back-End/- PostgreSQL 2019. 5. 24. 09:00
테이블 명 구조 기본정보 address_service_no(PK), user_no(PK), user_name, .... 전화번호 정보 address_service_no(PK/FK), phone_no(PK), phone_type, phone_number, ... 이메일주소 정보 address_service_no(PK/FK), email_no(PK), email_type, email_address, ... 직장정보 address_service_no(PK/FK), company_no(PK), company_name, .... 연락처 1개당 속해있는 전화번호, 이메일주소, 직장정보를 json array로 뽑아내는 것이다.
아래 'companyinfolist' 는 json_array로 뽑아낸 직장정보이다.
이렇게 array_to_json으로 데이터를 조회하니까 훨씬 속도가 빨라졌다.
참고: https://www.postgresql.org/docs/9.3/functions-json.html
PostgreSQL: Documentation: 9.3: JSON Functions and Operators
Table 9-40 shows the operators that are available for use with JSON (see Section 8.14) data. Table 9-40. JSON Operators Operator Right Operand Type Description Example -> int Get JSON array element '[1,2,3]'::json->2 -> text Get JSON object field '{"a":1,"
www.postgresql.org
'■ Back-End > - PostgreSQL' 카테고리의 다른 글
Table 생성시 column의 위치에 대하여 (0) 2019.02.04