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 6562813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:45:16+00:00 2026-05-25T13:45:16+00:00

I have a very basic web crawler. The database table which stores the links

  • 0

I have a very basic web crawler. The database table which stores the links it finds has a Unique index on the url field.

The logic I have so far is that for each link that is found on a page, the application will query the links tables to see if this link already exists. If it doesn’t already exist it will insert it.

In trying to get the best performance for the script, would it be ok to just skip the initial query which checks if the link already exists since if the link tries to get inserted it will fail anyway?

There will be more insert attempts because of this, but would eliminate the need for a full select query for every link found.

  • 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-25T13:45:16+00:00Added an answer on May 25, 2026 at 1:45 pm

    I would guess that running the select first will be faster, but testing is more reliable than intuition.

    The results depend on the relative speed of select, successful insert and failed insert. It is entirely possible that creating the error for the failed insert takes much more time than the additional select, but if that occurs infrequently enough it is still less than the additional select.

    For example, say that a select takes 1ms, a successful insert takes 20ms and a failed insert takes 10ms. (all numbers completely invented). If out of every 100 items 99 will succeed, then 100 select/insert will take 2080ms while insert/fail will take only 1990 ms. In on the other hand only 10 in 100 inserts will succeed then 100 select/insert will take 300ms while 100 insert/fail will take 1100ms.

    Short answer: time it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very basic ASP.NET web site. It has a single page (TestPage.aspx)
I am implementing a very simple file database. I have 2 basic operations: void
I have a very basic web page that uses flot to create a canvas
I'm developing a very basic web search engine that has several parts. After retrieving
I have a very basic question about MVC web applications in Java. Since the
I have a very basic knowledge of the web programming, and I couldn't figure
I recently upgraded VS 2005 to VS 2008. Unfortunately I have a very basic
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very simple problem which requires a very quick and simple solution
I have a very simple WPF application in which I am using data binding

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.