From efe2355bcd9f5a92da78756d4593a3ef0d326c6a Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Tue, 20 Dec 2016 09:51:36 +0900 Subject: [PATCH] remove alias in sqlite to improve performance Change-Id: I8ae872a6ca972ecd74ae1774ee2f4511fa65d1df --- server/db/ctsvc_db_query.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/server/db/ctsvc_db_query.c b/server/db/ctsvc_db_query.c index 23a889d..6f1bc84 100644 --- a/server/db/ctsvc_db_query.c +++ b/server/db/ctsvc_db_query.c @@ -3167,11 +3167,6 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que case CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP: case CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP_ASSIGNED: case CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED: - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " temp_contacts "); - if (0 <= temp_len) - len += temp_len; - break; - case CTSVC_ENUM_URI_PERSON: break; @@ -3295,7 +3290,7 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que len += temp_len; } temp_len = SAFE_SNPRINTF(&query, &query_size, len, ")) as temp_data ON " - "temp_data.temp_contact_id = temp_contacts.contact_id "); + "temp_data.temp_contact_id = contact_id "); if (0 <= temp_len) len += temp_len; } @@ -3305,8 +3300,8 @@ static inline int __ctsvc_db_search_records_with_query_exec(ctsvc_query_s *s_que case CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP: case CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP_ASSIGNED: case CTSVC_ENUM_URI_READ_ONLY_PERSON_GROUP_NOT_ASSIGNED: - temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE temp_contacts.person_id IN (SELECT " - "person_id FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND temp_contacts.contact_id IN "); + temp_len = SAFE_SNPRINTF(&query, &query_size, len, " WHERE person_id IN (SELECT " + "person_id FROM "CTS_TABLE_CONTACTS" WHERE deleted = 0 AND contact_id IN "); if (0 <= temp_len) len += temp_len; -- 2.7.4