Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5996207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:04:14+00:00 2026-05-23T00:04:14+00:00

I have written a feed aggregator before but am trying to optimize it a

  • 0

I have written a feed aggregator before but am trying to optimize it a bit. In the past, using simplepie (php class) to parse the feeds, I have used the get_id() function for each feed item to return a hash (an md5 mix of link + title). I store this “id” as the “remote_id” in MySQL. However to ensure that I have no duplicates I’ve been doing a SELECT query for each feed item to ensure that the “remote_id” does not exist. This seems inefficient considering I am looking at 1000’s of feeds.

Is it most efficient to just turn remote_id into a unique key and then let the database fail to write the new record on each pass? Any other way to engineer this that is better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:04:15+00:00Added an answer on May 23, 2026 at 12:04 am

    Yes, if a key should be unique in mysql, it’s generally a good idea to define it as a unique key.

    When inserting possible duplicates you may use PDO and try {} catch () {} statements to filter them out, they will throw an exception. You won’t have to check beforehand.

    I use something like this in a similar situation (pseudocode alert):

            $stmnt = $this->dbh->prepare('INSERT QUERY');  
    
            try {
                $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $this->dbh->beginTransaction();
    
                $stmnt->execute($celss);
    
                $this->dbh->commit();
            } catch (Exception $e)
            {
                $this->dbh->rollback();
                $this->invalidRows[] = array($cells,$e->getMessage());
                continue;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a site in Prototype but want to switch to jQuery. Any
I have written the following simple test in trying to learn Castle Windsor's Fluent
I have a python based application which works like a feed aggregator and needs
I have written an XML file which is using the ISO-8859-15 encoding and most
I have written a php program that generates rss feeds, however I am having
So i have a helper process written in C++ and I open it, feed
I have written a small program using Borland's C++ builder, and along the way,
I have written a program in C# using Visual Studio 2010. At current it
I have written a ListActivity class that uses a custom ArrayAdapter and Holders. I
i have written an iphone application but when i run it only blank screen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.