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
  • 3 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

Related Questions

I need a table which has two columns: First column have an ID Second
I have a table y Which has two columns a and b Entries are:
I have a logging table which has three columns. One column is a unique
I have a table User which has an identity column UserID , now what
I have a table of users which has a username column consisting of a
I have a table in SQL Server 2005 which has three columns: id (int),
I have a projects table which has two foreign keys for users (user_id and
I have a table called user_relationship. which has two foreign keys refering back to
I have a SQL table which has a number of fields ID | Value
I have a table called BlogPost which has a 1-to-many relationship with the Comment

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.