remove alias in sqlite to improve performance 58/105858/2
authorJeesun Kim <iamjs.kim@samsung.com>
Tue, 20 Dec 2016 00:51:36 +0000 (09:51 +0900)
committerjeesun kim <iamjs.kim@samsung.com>
Tue, 20 Dec 2016 04:38:18 +0000 (20:38 -0800)
Change-Id: I8ae872a6ca972ecd74ae1774ee2f4511fa65d1df

server/db/ctsvc_db_query.c

index 23a889d..6f1bc84 100644 (file)
@@ -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;