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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:13:01+00:00 2026-05-15T21:13:01+00:00

I was a MySQL user. Now I’m migrating to SQL Server. But I have

  • 0

I was a MySQL user. Now I’m migrating to SQL Server. But I have a problem. I can not find any way for specifiying the kind of index a table has. In MySQL I could easily say to build a BTree Index or Hash Index. How can I do that here?

The main problem is that I have two tables. one of them (named “posts”) has a foreign key to the other (named “users”) which has a primary key constraint on “id”. In my java program for inserting posts I have to check whether the user of this post has been inserted or not and if not, insert it (I can not insert all users first!).

This code was inserting about 1000 posts in each 10 seconds in MySQL. But In SQL Server the search part takes too much time and 1000 posts takes more than 1 minute.

This is the slow SQL query:

select * from users u where u.id = "UserName"

This is the user table:

CREATE TABLE [dbo].[users](
[id] [varchar](50) NOT NULL,
[type] [char](1) NULL,
[name] [nvarchar](150) NULL,
[reserved] [char](8) NULL,
[description] [nvarchar](4000) NULL,
[text] [ntext] NULL,
 CONSTRAINT [PK__users__3213E83F00551192] PRIMARY KEY CLUSTERED 
(
    [id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

What’s the problem?

Thank you.

  • 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-15T21:13:01+00:00Added an answer on May 15, 2026 at 9:13 pm

    SQL Server does not support hash indexes. The list of available indexes can be found here.

    If you are trying to insert thousands of records per second it sounds like you would be better off using a BULK INSERT. Ideally you would do this:

    • Bulk insert all users.
    • Bulk insert all messages.

    Given your requirement to not insert all the users first I would suggest something like this:

    • Remove your foreign key constraint.
    • Bulk insert all the messages.
    • Query to find which users are missing and insert them (this can be done in one statement).
    • Add the constraint again.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.