CN107656936B - Terminal database construction method in field of instant messaging - Google Patents

Terminal database construction method in field of instant messaging Download PDF

Info

Publication number
CN107656936B
CN107656936B CN201610595093.6A CN201610595093A CN107656936B CN 107656936 B CN107656936 B CN 107656936B CN 201610595093 A CN201610595093 A CN 201610595093A CN 107656936 B CN107656936 B CN 107656936B
Authority
CN
China
Prior art keywords
database
group member
group
message
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610595093.6A
Other languages
Chinese (zh)
Other versions
CN107656936A (en
Inventor
杨厂普
党艳平
王斌
胡宏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing North Source Software Co ltd
Original Assignee
Beijing North Source Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing North Source Software Co ltd filed Critical Beijing North Source Software Co ltd
Priority to CN201610595093.6A priority Critical patent/CN107656936B/en
Publication of CN107656936A publication Critical patent/CN107656936A/en
Application granted granted Critical
Publication of CN107656936B publication Critical patent/CN107656936B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1435Saving, restoring, recovering or retrying at system level using file system or storage system metadata
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Library & Information Science (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method for constructing a terminal database in the field of instant messaging, which divides various data related to the database into a system information database, a group member database and a chat message database; the information in the system information database comprises recent contacts, friends, personal settings, system configuration and groups; the information in the group member database comprises group member information and a group member timestamp; the information in the chat message database includes chat messages. The database construction method can greatly reduce the terminal development difficulty of instant messaging application/software, reduce development time and reduce development capital and time cost; the execution efficiency of the instant communication application/software can be obviously improved, the energy consumption is reduced, and the use experience of a user is improved; when the later-stage terminal chat data backup maintenance is used, the archiving database is used for backup, the current database is not influenced to continuously provide rapid reading and writing service, and the backup maintenance is convenient.

Description

Terminal database construction method in field of instant messaging
Technical Field
The invention relates to the field of instant messaging, in particular to a method for constructing a terminal database in the field of instant messaging.
Background
Instant messaging, which refers to a service of instant messaging based on the internet, is also called "real-time communication", abbreviated as IM. Allowing two or more people to communicate text messages, files, voice and video in real time using a network.
Under the condition that various current desktop devices and mobile devices are popularized, the market demand in the field of timely communication is increased explosively, and the number of software and applications is also increased greatly. But good products are not many in actual use, most products have poor use experience, or the experience is good when the products are installed and used, the system is slower and slower after the products are used for a period of time, and the experience is poor.
Part of the phenomenon is caused by that the network IO is not processed well, which can involve the server part, and the terminal developer can not completely solve the problem; one part is that the disk IO is not processed well, that is, the terminal cache data is not processed well. Since the structured data cached by the terminal is basically stored in the local database, which is actually a problem of database processing, the problem can be well processed at the terminal.
In engineering applications, the method for improving the database efficiency is basically a method of adding an index or a table. But have different characteristics when applied to a certain field. Software or application in different fields has different service characteristics, and products in the same field have different functional emphasis points, so that designing a set of high-efficiency local cache database processing method in the field of instant messaging becomes an important subject.
Most of the processing methods adopted by the existing terminal databases are immature methods such as a method of losing cache data or a method of not classifying and optimizing. However, this ultimately results in a system that is not as efficient as a whole and that is not experienced well by the user.
There are also some software/applications that use database optimization methods, but there are also a number of problems: 1. the optimization means is single, the conventional method is to add indexes, and the index is not classified according to actual services, so that the index is used more and less slowly along with the increase of data volume; 2. the sub-table optimization is carried out, a systematic methodology is lacked, the work handover is influenced by the experience of developers, and the situations of data asynchronism and resource waste often occur.
Disclosure of Invention
The present invention aims to solve the above technical problems, and provide a method for constructing a terminal database in the field of instant messaging, which can ensure the overall efficiency of a system under the condition of large data volume.
In order to solve the technical problems, the invention adopts the following technical scheme: a method for constructing a terminal database in the field of instant messaging comprises the following steps: dividing various data related to the database into a system information database, a group member database and a chat message database; the information in the system information database comprises recent contacts, friends, personal settings, system configuration and groups; the information in the group member database comprises group member information and a group member timestamp; the information in the chat message database includes chat messages.
As mentioned above, in the method for constructing a terminal database in the field of instant messaging, the data table for storing the information in the system information database is placed in a single database, and may be cached in the memory during the operation of the system, or the database may be directly operated.
As in the aforementioned method for constructing a terminal database in the field of instant messaging, the group member database includes a group member information table for storing the group member information, and the name of the group member information is dynamically generated according to the unique ID of the group; the number of the group member information table is the same as the number of the groups.
As in the foregoing method for constructing a terminal database in the field of instant messaging, when reading the group member information, a group member database table may be found according to the unique ID of the group, and the reading is performed only on the group member database table.
As mentioned above, in the method for constructing a terminal database in the field of instant messaging, the group member database further includes a group member timestamp table for recording timestamp information of each group member.
As mentioned above, the chat message database comprises: a current message database and a historical archive database; the chat messages comprise current messages and historical archiving messages; and storing the message lists in the message database and the history archive database respectively, wherein the names of the message lists are dynamically generated according to the unique ID of the chat object.
As mentioned above, in the method for constructing a terminal database in the instant messaging field, the message tables of the current message database and the historical archive database both include a contact message table and a group message table.
As in the aforementioned method for constructing a terminal database in the instant messaging field, the number of messages stored in the contact message table and the group message table of the current message database has an upper threshold, and when the number of messages is greater than the threshold, the earlier messages are deleted, and the number of entries in the contact message table and the group message table is not greater than the threshold.
As mentioned above, in the method for constructing a terminal database in the field of instant messaging, when a new message arrives, the current message database is written first, and then the historical archive database is written.
Compared with the prior art, the invention divides various data related to the database into a system information database, a group member database and a chat message database; the information in the system information database comprises recent contacts, friends, personal settings, system configuration and groups; the information in the group member database comprises group member information and a group member timestamp; the information in the chat message database comprises chat messages, and the method can greatly reduce the terminal development difficulty of instant messaging application/software, reduce development time and reduce development capital and time cost; the execution efficiency of the instant communication application/software can be obviously improved, the energy consumption is reduced, and the use experience of a user is improved; when the later-stage terminal chat data backup maintenance is used, the archiving database is used for backup, the current database is not influenced to continuously provide rapid reading and writing service, and the backup maintenance is convenient.
Drawings
FIG. 1 is a schematic flow diagram of the process of the present invention;
FIG. 2 is a flow chart of loading a system information database according to the present invention;
FIG. 3 is a flow chart of loading a group member database according to the present invention;
FIG. 4 is a flow chart of loading a group member database according to the present invention.
The invention is further described with reference to the following figures and detailed description.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments, but not all embodiments, of the present invention.
In embodiment 1 of the present invention, as shown in fig. 1, information in the system information database includes recent contacts, friends, personal settings, system configuration, and groups; the data table for storing the information in the system information database is placed in a separate file database, which can be named MAIN _ DB;
because the number of files in the system information database is not large, the files can be cached in a memory during the operation of the system, and the database can also be directly operated, so that the influence on the performance and experience of the system is not large;
then establishing a group member database GMBER _ DB; the information in the group member database comprises group member information and group member timestamps;
a list of group member information in a group member database, the name of which can be dynamically generated based on the unique ID of the group. For example, the unique ID of the group is 10000, and the name of the group membership table can be named gbr _10000_ tbl. As many groups as there are, as many group member information tables;
a group member timestamp table in the group member database, for recording timestamp information of each group member;
when the group member information is read in the timely communication, the database table can be found according to the unique identification of the group, the reading is only carried out on the table, the operation data set is small, and the read-write operation of other groups is not influenced;
and establishing a chat message database MSG _ DB and an OLDMSG _ DB. MSD _ DB is a current message database, and OLDMSG _ DB is a historical archive database;
only one table in the MSG _ DB is a message table, and the name of the table can be dynamically generated according to the unique ID of the chat object;
the chat objects are divided into people and groups, if the IDs of the people and the groups are in the same system, for example, the ID of the chat object is 10000, the name of the message table can be named msg _10000_ tbl;
if the ID of the person and group are not in the same hierarchy, such as the group ID is 10000, the name of the group message table can be named msg _1_10000_ tbl, the person ID is 10000, and the name of the person message table can be named msg _2_10000_ tbl.
The MSG _ DB and the OLDMSG _ DB have the same database structure, and the table names and the number of tables are the same;
the messages stored in the table in the MSG _ DB have an upper limit of quantity, a maximum message quantity threshold value can be set, most applicable scenes are scenes in which a user needs to quickly check the recent chat information records, and because the data volume in each table is small, the retrieval can be quickly carried out;
all locally generated history information is stored in the OLDMSG _ DB, the naming mode of the table is the same as that of the MSG _ DB, and the number of the tables is the same;
the MSG _ DB table has a maximum message number threshold, and when the number of messages in the table is greater than the threshold, older messages are deleted, keeping the number of entries in each table not greater than the threshold.
Because the number of times of reading the message and the experience during reading are far greater than those during writing the message, when a new message arrives, the current table in the MSG _ DB is written first, and then the history table of the OLDMSG _ DB is written.
After the application/software passes the authentication, as shown in fig. 2, the process of loading the system information database is as follows: and firstly loading a timestamp of the data from the server, then comparing the timestamp with the local timestamp according to the local timestamp, firstly loading a system information database, and finally storing the data into the MAIN _ DB.
As shown in fig. 3, the group member database is loaded: first, find group _1 in the group table, obtain group member timestamp, if the group member timestamp table does not exist, establish database GMBER _ DB, establish group member table gbr _1_ tbl, compare local timestamp with network timestamp, and update the member data table of group gbr _1_ tbl.
As shown in fig. 4, the group member database is loaded: and sending a message in the group _1, generating a message MSG1 after the network interface is successfully called, judging whether a message database MSG _ DB exists, and if not, establishing the database MSG _ DB. Determining whether msg _ g1_ tbl exists, if not, re-establishing table msg _ g1_ tbl and inserting chat data msg1 into msg _ g1_ tbl;
and judging whether the history database OLDMSG _ DB exists or not, and if not, establishing the database OLDMSG _ DB. It is determined whether table msg _ g1_ tbl exists in the OLDMSG _ DB, and if not, table msg _ g1_ tbl is created. Message data msg1 is then inserted into msg _ g1_ tbl;
finally, it is judged whether the data quantity of the msg _ g1_ tbl table is greater than the message threshold value of 5000 pieces, if so, the messages are deleted in bulk to 2000 pieces, and the latest 2000 pieces are reserved.
When the latest 10 message records of the group _1 need to be checked, whether the MSG _ DB exists is judged, and if the MSG _ DB does not exist, the operation returns. If so, a determination is made as to whether message table msg _ g1_ tbl is present, and if not, a return is made. By msg _ g1_ tbl query message record, if any, the SQLITE database base query used returns on the millisecond level since the single table database volume does not exceed 5000.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A method for constructing a terminal database in the field of instant messaging is characterized by comprising the following steps: dividing various data related to the database into a system information database, a group member database and a chat message database; the information in the system information database comprises recent contacts, friends, personal settings, system configuration and groups; the information in the group member database comprises group member information and a group member timestamp; the chat message database comprises a current message database and a historical archive database, and information in the chat message database comprises chat messages;
the data table for storing the information in the system information database is placed in a single database and can be cached in a memory during the operation of the system for directly operating the database;
the group member database comprises a group member information table and a group member time stamp table; the group member information table includes: a group ID and group members; the group member timestamp table is used for recording timestamps of all group members; wherein, each group corresponds to a group member information table;
the method further comprises the following steps: loading a group member database, comprising: finding a group identifier in a group table, acquiring a group member timestamp from the group member timestamp table according to the group identifier, comparing a local timestamp with a network timestamp, and updating a group member information table corresponding to the group identifier; wherein the network time stamp is a time stamp of the corresponding data loaded from the server.
2. The method for constructing a terminal database in the field of instant messaging according to claim 1, wherein said group member database comprises a group member information table for storing said group member information, the name of said group member information being dynamically generated based on the unique ID of the group; the number of the group member information table is the same as the number of the groups.
3. The method as claimed in claim 1, wherein when reading the group member information, the group member database table can be found according to the unique ID of the group, and the reading is performed only on the group member database table.
4. The method as claimed in claim 1, wherein the group member database further comprises a group member timestamp table for recording timestamp information of each group member.
5. The method for constructing a terminal database in the field of instant messaging according to claim 1, wherein the chat message database comprises: a current message database and a historical archive database; the chat messages comprise current messages and historical archiving messages; and storing the message lists in the message database and the history archive database respectively, wherein the names of the message lists are dynamically generated according to the unique ID of the chat object.
6. The method as claimed in claim 5, wherein the message tables of the current message database and the historical archive database each include a contact message table and a group message table.
7. The method as claimed in claim 6, wherein the number of messages stored in the contact message table and the group message table of the current message database has an upper threshold, and when the number of messages is greater than the threshold, the earlier messages are deleted, and the number of entries in the contact message table and the group message table is kept no greater than the threshold.
8. The method as claimed in claim 7, wherein the current message database is written first and then the historical archive database is written when a new message arrives.
CN201610595093.6A 2016-07-26 2016-07-26 Terminal database construction method in field of instant messaging Active CN107656936B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610595093.6A CN107656936B (en) 2016-07-26 2016-07-26 Terminal database construction method in field of instant messaging

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610595093.6A CN107656936B (en) 2016-07-26 2016-07-26 Terminal database construction method in field of instant messaging

Publications (2)

Publication Number Publication Date
CN107656936A CN107656936A (en) 2018-02-02
CN107656936B true CN107656936B (en) 2021-03-02

Family

ID=61127403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610595093.6A Active CN107656936B (en) 2016-07-26 2016-07-26 Terminal database construction method in field of instant messaging

Country Status (1)

Country Link
CN (1) CN107656936B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108989062B (en) 2018-07-25 2020-05-01 北京达佳互联信息技术有限公司 Method, device, terminal, system and storage medium for updating group member data
CN109446204B (en) * 2018-11-27 2022-04-15 北京微播视界科技有限公司 Data storage method and device for instant messaging, electronic equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1992625A (en) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 Method for processing muti-topic discussion group information flow based on instant communication
US7725552B2 (en) * 2006-01-24 2010-05-25 Markport Limited Content and service delivery in telecommunication networks
CN101997783A (en) * 2009-08-21 2011-03-30 阿里巴巴集团控股有限公司 Implementation method and server for instant messaging tool contact structured group

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1992625A (en) * 2005-12-28 2007-07-04 腾讯科技(深圳)有限公司 Method for processing muti-topic discussion group information flow based on instant communication
US7725552B2 (en) * 2006-01-24 2010-05-25 Markport Limited Content and service delivery in telecommunication networks
CN101997783A (en) * 2009-08-21 2011-03-30 阿里巴巴集团控股有限公司 Implementation method and server for instant messaging tool contact structured group

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
QQ5.9.1版本;乐游网;《QQ5.9.1》;20160720;图1-4 *

Also Published As

Publication number Publication date
CN107656936A (en) 2018-02-02

Similar Documents

Publication Publication Date Title
CN109033360B (en) Data query method, device, server and storage medium
KR20110079740A (en) Search based specification for data synchronization
US10824612B2 (en) Key ticketing system with lock-free concurrency and versioning
US11507277B2 (en) Key value store using progress verification
CN111414424B (en) Method, system, medium and equipment for automatically synchronizing redis of configuration data
CN111930768B (en) Incremental data acquisition method, incremental data transmission method, incremental data acquisition device, incremental data transmission device and computer storage medium
CN111654532A (en) Centralized management system, method and device for configuration files
CN107656936B (en) Terminal database construction method in field of instant messaging
CN113076290A (en) File deletion method, device, equipment, system and storage medium
US20200311029A1 (en) Key value store using generation markers
US11210212B2 (en) Conflict resolution and garbage collection in distributed databases
CN114356878A (en) Distributed storage method and device for unstructured data
CN108280215B (en) Hybrid updating method of E-commerce index file based on Solr
CN116701413A (en) Main data processing method and device
EP3343395A1 (en) Data storage method and apparatus for mobile terminal
CN106549983B (en) Database access method, terminal and server
US10248314B2 (en) Migrate nickname cache for email systems and devices
CN113905022B (en) Group chat construction method, device and storage medium
CN116049306A (en) Data synchronization method, device, electronic equipment and readable storage medium
US20080059538A1 (en) Method and system for synchronizing offline records
CN115309336A (en) Data writing method, cache information updating method and related device
CN108763498B (en) User identity identification method and device, electronic equipment and readable storage medium
CN114328129A (en) Message sending method, device, equipment and storage medium
CN115080504A (en) File management method, terminal and storage medium
CN113986840A (en) Block chain data multilevel storage and reading method and storage system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant