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

  • Home
  • SEARCH
  • 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 198847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:58:22+00:00 2026-05-11T16:58:22+00:00

I have a table which has two varchar(Max) columns Column 1 Column 2 ———————–

  • 0

I have a table which has two varchar(Max) columns

Column 1      Column 2
-----------------------
URLRewitten   OriginalURL

its part of my url re-writing for an asp.net webforms site.

when a url comes in I do a check to see if its in the table if it is i use the OriginalURL.

My question is, if all I’m doing is querying the table for urls and no other table in the database will ever link to this table does it need a dedicated primary key field? like an auto-number? will this make queries faster?

and also how can I make the query’s run as faster?

Edit: I do have a unique constraint on URLRewitten.

Edit: ways i’m using this table..

  • Query when a new Request comes in.. search on URLRewitten to find OriginalURL
  • When needing to display a link on the site, i query on the OriginalURL to find the URLRewitten url i should use.
  • When adding a new url to the table i make sure that it doesn’t already exist.

thats all the querys i do.. at the moment.

Both columns together would be unique.

  • 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-11T16:58:22+00:00Added an answer on May 11, 2026 at 4:58 pm

    Do you need a primary key? Yes. Always. However, it looks like in your case OriginalURL could be your primary key (I’m assuming that there wouldn’t be more than one value for URLRewritten for a given value in OriginalURL).

    This is what’s known as a “natural key” (where a component of the data itself is, by its nature, unique). These can be convenient, though I have found that they’re generally more trouble than they’re worth under most circumstances, so yes, I would recommend some sort of opaque key (meaning a key that has no relation to the data in the row, other than to identify a single row). Whether or not you want an autonumber is up to you. It’s certainly convenient, though identity columns come with their own set of advantages and disadvantages.

    For now I suppose I would advise creating two things:

    1. A primary key on your table of an identity column
    2. A unique constraint on OriginalURL to enforce data integrity.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 107k
  • Answers 107k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have a race condition between inserting and retrieving the… May 11, 2026 at 9:08 pm
  • Editorial Team
    Editorial Team added an answer As you can see from my edit, it seems that… May 11, 2026 at 9:08 pm
  • Editorial Team
    Editorial Team added an answer I would catch the most "specific" exception first, then further… May 11, 2026 at 9:08 pm

Related Questions

How can I make an ORDER BY clause with a small LIMIT (ie 20
Which is your preference? Let's say we have a generic Product table that has
I have two tables that are something like this: Main table: id (int), title
I'm in the process of working on a user profile system for a website
I have a table y Which has two columns a and b Entries are:

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.