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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:39:24+00:00 2026-06-15T14:39:24+00:00

Method #1 (fulltext): CREATE TABLE `addresses` ( `id` int(10) unsigned NOT NULL auto_increment, `mail`

  • 0

Method #1 (fulltext):

CREATE TABLE `addresses` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `mail` text NOT NULL,
  PRIMARY KEY  (`id`),
  FULLTEXT KEY `mail` (`mail`)
);

find out exists with searching:

SELECT * FROM addresses WHERE MATCH(email) AGAINST('"name@example.com"' IN BOOLEAN MODE)

or method #2 (unique varchar):

CREATE TABLE `addresses` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `mail` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `mail` (`mail`)
);

find out exists with insert:

INSERT INTO `addresses` (`id`, `mail`) VALUES (NULL ,  'name@example.com');

if fail then exists:

#1062 - Duplicate entry 'name@example.com' for key 2 

which method is better for find out exists mail addresses in thousands of rows?

  • 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-06-15T14:39:25+00:00Added an answer on June 15, 2026 at 2:39 pm

    Method 3 (with the unique varchar) is better:

    SELECT * FROM addresses WHERE email = 'name@example.com'
    

    FullText search for a exact match isn’t a great idea and using an insert to test if something exists is just wrong (although correct if you’re planning to insert it regardless).

    Note that the unique constraint can be case insensitive depending on the encoding. If you use utf-8-bin it will be base sensitive.

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

Sidebar

Related Questions

Method keySet() . Examples works fine, but I not sure if I'm right.
Quick method description: I have two tables, lets name them table ONE and table
I can not figure out how to fix this issue!!! Please help!! undefined method
How to force MySQL to create FULLTEXT index of words with 1, 2, and
Method 1: InetAddress addr = InetAddress.getByName(192.168.0.101); int port = 18250; Socket socket = new
I'm trying to create an assert method in Javascript. I've been struggling with arguments.callee.caller
I have title (varchar), description (text), keywords (varchar) fields in my mysql table. I
I want to create a static Hash table to convert strings to integers .
I've been trying to find some help on using MySQL's FULLTEXT search. I realise
I'm trying to perform a fulltext search with codeigniters built in Active Record methods.

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.