Hi.
There's a site containing dozens of text snippets, each of them may have links and I need to build connections between snippets. Snippets are stored in database, database layout is following:
snippet: id primary key, title varchar(255), url varchar(400), body text references: snippet_id, crc32_sum backlinks: snippet_id, links_to
process of adding new snippet:
sanitize url, generate its crc32 sum and find all entries in references table having crc32_sum = new urls crc32 sum. if there are such records add them to backlinks where snippet_id is entry having new urls crc32 sum and links_to - new snippets id
grab all links from new snippets text, sanitize them, calculate their crc32 sum and put it all into references where snippet_id is id of new snippet and crc32 sum is sum of the found link
sanitizing url and link grabbing are done with PHP, crc32 works in MySQL.
Can I somehow optimize this process? I've added indexes in MySQL, tried to put as many crc32 in request as possible, but still its dead slow :(