Query from 3 tables, lasts foreverUnable to relate two MySQL tables (foreign keys)MySQL Syntax Error on Table CreationVb.net error for query and databaseusing limit and where clause to make paginationLiquibase: How to set Charset UTF-8 on MySQL database tables?mysql relation slowhow to fetch menu from database with its subcategoryJOIN Query In MYSQL and PHP#1072 - Key column 'Name' doesn't exist in tableI am having 2 tables, 1st is friends and 2nd is post
Could an aircraft fly or hover using only jets of compressed air?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Why does Kotter return in Welcome Back Kotter?
Why can't I see bouncing of switch on oscilloscope screen?
How much of data wrangling is a data scientist's job?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
Mortgage Pre-approval / Loan - Apply Alone or with Fiancée?
Today is the Center
Theorems that impeded progress
Can you really stack all of this on an Opportunity Attack?
Can I make popcorn with any corn?
Approximately how much travel time was saved by the opening of the Suez Canal in 1869?
Why is consensus so controversial in Britain?
Does detail obscure or enhance action?
How to move a thin line with the black arrow in Illustrator?
Why is Minecraft giving an OpenGL error?
What would happen to a modern skyscraper if it rains micro blackholes?
Replacing matching entries in one column of a file by another column from a different file
Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?
Do infinite dimensional systems make sense?
What's that red-plus icon near a text?
Unable to deploy metadata from Partner Developer scratch org because of extra fields
How to source a part of a file
Query from 3 tables, lasts forever
Unable to relate two MySQL tables (foreign keys)MySQL Syntax Error on Table CreationVb.net error for query and databaseusing limit and where clause to make paginationLiquibase: How to set Charset UTF-8 on MySQL database tables?mysql relation slowhow to fetch menu from database with its subcategoryJOIN Query In MYSQL and PHP#1072 - Key column 'Name' doesn't exist in tableI am having 2 tables, 1st is friends and 2nd is post
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am using mysql-workbench
6.3 on Ubuntu 18.04.
I have three tables created as follows:
CREATE TABLE `prefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
-----------------
sub.example.net
The second table:
CREATE TABLE `noprefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
----------------------
example.net
The third table:
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`),
UNIQUE KEY `new_domain_UNIQUE` (`new_domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 3 fields but I do not query them, omitted for brevity.
Example:
new_domain
------------------------
http://sub.example.com
I want to make a query that identifies the shared name example.com
in the three tables as follows:
Query:
SELECT `new_random`.`new_domain`,`prefix_random`.`domain`,`noprefix_random`.`domain`
FROM `myscheme`.`new_random`
JOIN `myscheme`.`prefix_random`
# the substring to extract the part: sub.example.com
ON substring_index(`new_random`.`new_domain`,'http://',-1) = `prefix_random`.`domain`
JOIN `myscheme`.`noprefix_random`
# by adding sub, it becomes: sub.example
ON CONCAT('sub.',`noprefix_random`.`domain`) = `new_domain`,`prefix_random`;
The expected output is:
http://sub.example.com, sub.example.com, example.com
The query lasts forever. If I limit the output to small number using L
LIMIT 10;
I get results. The records number is not too larges. prefix_random
contains 620062, noprefix_random
contains , and the 62294, and the 588380 records.
What is the problem? Can you help me make the query run?
mysql database relational-database mysql-workbench database-performance
add a comment |
I am using mysql-workbench
6.3 on Ubuntu 18.04.
I have three tables created as follows:
CREATE TABLE `prefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
-----------------
sub.example.net
The second table:
CREATE TABLE `noprefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
----------------------
example.net
The third table:
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`),
UNIQUE KEY `new_domain_UNIQUE` (`new_domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 3 fields but I do not query them, omitted for brevity.
Example:
new_domain
------------------------
http://sub.example.com
I want to make a query that identifies the shared name example.com
in the three tables as follows:
Query:
SELECT `new_random`.`new_domain`,`prefix_random`.`domain`,`noprefix_random`.`domain`
FROM `myscheme`.`new_random`
JOIN `myscheme`.`prefix_random`
# the substring to extract the part: sub.example.com
ON substring_index(`new_random`.`new_domain`,'http://',-1) = `prefix_random`.`domain`
JOIN `myscheme`.`noprefix_random`
# by adding sub, it becomes: sub.example
ON CONCAT('sub.',`noprefix_random`.`domain`) = `new_domain`,`prefix_random`;
The expected output is:
http://sub.example.com, sub.example.com, example.com
The query lasts forever. If I limit the output to small number using L
LIMIT 10;
I get results. The records number is not too larges. prefix_random
contains 620062, noprefix_random
contains , and the 62294, and the 588380 records.
What is the problem? Can you help me make the query run?
mysql database relational-database mysql-workbench database-performance
Note, primary keys are a) keys and b) always unique. A secondary key on the same is unnecessary.
– danblack
Mar 21 at 23:11
Each of my tables has a primary key. What are you trying to point? I am not getting your point sorry.
– user9371654
Mar 21 at 23:20
You xxx_UNIQUE keys are not needed because the same field is a primary key.
– danblack
Mar 21 at 23:22
@danblack this does not harm. What is the problem?
– user9371654
Mar 21 at 23:23
add a comment |
I am using mysql-workbench
6.3 on Ubuntu 18.04.
I have three tables created as follows:
CREATE TABLE `prefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
-----------------
sub.example.net
The second table:
CREATE TABLE `noprefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
----------------------
example.net
The third table:
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`),
UNIQUE KEY `new_domain_UNIQUE` (`new_domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 3 fields but I do not query them, omitted for brevity.
Example:
new_domain
------------------------
http://sub.example.com
I want to make a query that identifies the shared name example.com
in the three tables as follows:
Query:
SELECT `new_random`.`new_domain`,`prefix_random`.`domain`,`noprefix_random`.`domain`
FROM `myscheme`.`new_random`
JOIN `myscheme`.`prefix_random`
# the substring to extract the part: sub.example.com
ON substring_index(`new_random`.`new_domain`,'http://',-1) = `prefix_random`.`domain`
JOIN `myscheme`.`noprefix_random`
# by adding sub, it becomes: sub.example
ON CONCAT('sub.',`noprefix_random`.`domain`) = `new_domain`,`prefix_random`;
The expected output is:
http://sub.example.com, sub.example.com, example.com
The query lasts forever. If I limit the output to small number using L
LIMIT 10;
I get results. The records number is not too larges. prefix_random
contains 620062, noprefix_random
contains , and the 62294, and the 588380 records.
What is the problem? Can you help me make the query run?
mysql database relational-database mysql-workbench database-performance
I am using mysql-workbench
6.3 on Ubuntu 18.04.
I have three tables created as follows:
CREATE TABLE `prefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
-----------------
sub.example.net
The second table:
CREATE TABLE `noprefix_random` (
`domain` varchar(500) NOT NULL,
PRIMARY KEY (`domain`),
UNIQUE KEY `domain_UNIQUE` (`domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 32 fields but I do not query them, omitted for brevity.
Example:
domain
----------------------
example.net
The third table:
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`),
UNIQUE KEY `new_domain_UNIQUE` (`new_domain`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
Note: there are additional 3 fields but I do not query them, omitted for brevity.
Example:
new_domain
------------------------
http://sub.example.com
I want to make a query that identifies the shared name example.com
in the three tables as follows:
Query:
SELECT `new_random`.`new_domain`,`prefix_random`.`domain`,`noprefix_random`.`domain`
FROM `myscheme`.`new_random`
JOIN `myscheme`.`prefix_random`
# the substring to extract the part: sub.example.com
ON substring_index(`new_random`.`new_domain`,'http://',-1) = `prefix_random`.`domain`
JOIN `myscheme`.`noprefix_random`
# by adding sub, it becomes: sub.example
ON CONCAT('sub.',`noprefix_random`.`domain`) = `new_domain`,`prefix_random`;
The expected output is:
http://sub.example.com, sub.example.com, example.com
The query lasts forever. If I limit the output to small number using L
LIMIT 10;
I get results. The records number is not too larges. prefix_random
contains 620062, noprefix_random
contains , and the 62294, and the 588380 records.
What is the problem? Can you help me make the query run?
mysql database relational-database mysql-workbench database-performance
mysql database relational-database mysql-workbench database-performance
edited Mar 21 at 22:54
user9371654
asked Mar 21 at 22:46
user9371654user9371654
464523
464523
Note, primary keys are a) keys and b) always unique. A secondary key on the same is unnecessary.
– danblack
Mar 21 at 23:11
Each of my tables has a primary key. What are you trying to point? I am not getting your point sorry.
– user9371654
Mar 21 at 23:20
You xxx_UNIQUE keys are not needed because the same field is a primary key.
– danblack
Mar 21 at 23:22
@danblack this does not harm. What is the problem?
– user9371654
Mar 21 at 23:23
add a comment |
Note, primary keys are a) keys and b) always unique. A secondary key on the same is unnecessary.
– danblack
Mar 21 at 23:11
Each of my tables has a primary key. What are you trying to point? I am not getting your point sorry.
– user9371654
Mar 21 at 23:20
You xxx_UNIQUE keys are not needed because the same field is a primary key.
– danblack
Mar 21 at 23:22
@danblack this does not harm. What is the problem?
– user9371654
Mar 21 at 23:23
Note, primary keys are a) keys and b) always unique. A secondary key on the same is unnecessary.
– danblack
Mar 21 at 23:11
Note, primary keys are a) keys and b) always unique. A secondary key on the same is unnecessary.
– danblack
Mar 21 at 23:11
Each of my tables has a primary key. What are you trying to point? I am not getting your point sorry.
– user9371654
Mar 21 at 23:20
Each of my tables has a primary key. What are you trying to point? I am not getting your point sorry.
– user9371654
Mar 21 at 23:20
You xxx_UNIQUE keys are not needed because the same field is a primary key.
– danblack
Mar 21 at 23:22
You xxx_UNIQUE keys are not needed because the same field is a primary key.
– danblack
Mar 21 at 23:22
@danblack this does not harm. What is the problem?
– user9371654
Mar 21 at 23:23
@danblack this does not harm. What is the problem?
– user9371654
Mar 21 at 23:23
add a comment |
1 Answer
1
active
oldest
votes
The best way to deal with domains is to use generated columns that has the reverse function on them and index this generated columns. This way a significant amount of queries can be WHERE domain LIKE CONCAT(reverse(const),'%')
and use an index.
Removing http://
in a query is also an expensive way to do this. Use this in a generated function/index too.
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`))
INSERT INTO new_random VALUES ('http://a.b.c'),('http://d.e.f')
ALTER TABLE new_random ADD no_https VARCHAR(500) AS (substring_index(`new_domain`,'http://',-1)), ADD KEY(no_https)
ALTER TABLE new_random ADD rev_domain VARCHAR(500) AS (REVERSE(no_https)), ADD KEY(rev_domain)
SELECT * FROM new_random
new_domain | no_https | rev_domain
:----------- | :------- | :---------
http://a.b.c | a.b.c | c.b.a
http://d.e.f | d.e.f | f.e.d
EXPLAIN SELECT new_domain FROM new_random WHERE rev_domain LIKE 'c.b.%'
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
-: | :---------- | :--------- | :--------- | :---- | :------------ | :--------- | :------ | :--- | ---: | -------: | :-----------------------
1 | SIMPLE | new_random | null | range | rev_domain | rev_domain | 2003 | null | 1 | 100.00 | Using where; Using index
db<>fiddle here
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
1
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290362%2fquery-from-3-tables-lasts-forever%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The best way to deal with domains is to use generated columns that has the reverse function on them and index this generated columns. This way a significant amount of queries can be WHERE domain LIKE CONCAT(reverse(const),'%')
and use an index.
Removing http://
in a query is also an expensive way to do this. Use this in a generated function/index too.
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`))
INSERT INTO new_random VALUES ('http://a.b.c'),('http://d.e.f')
ALTER TABLE new_random ADD no_https VARCHAR(500) AS (substring_index(`new_domain`,'http://',-1)), ADD KEY(no_https)
ALTER TABLE new_random ADD rev_domain VARCHAR(500) AS (REVERSE(no_https)), ADD KEY(rev_domain)
SELECT * FROM new_random
new_domain | no_https | rev_domain
:----------- | :------- | :---------
http://a.b.c | a.b.c | c.b.a
http://d.e.f | d.e.f | f.e.d
EXPLAIN SELECT new_domain FROM new_random WHERE rev_domain LIKE 'c.b.%'
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
-: | :---------- | :--------- | :--------- | :---- | :------------ | :--------- | :------ | :--- | ---: | -------: | :-----------------------
1 | SIMPLE | new_random | null | range | rev_domain | rev_domain | 2003 | null | 1 | 100.00 | Using where; Using index
db<>fiddle here
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
1
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
add a comment |
The best way to deal with domains is to use generated columns that has the reverse function on them and index this generated columns. This way a significant amount of queries can be WHERE domain LIKE CONCAT(reverse(const),'%')
and use an index.
Removing http://
in a query is also an expensive way to do this. Use this in a generated function/index too.
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`))
INSERT INTO new_random VALUES ('http://a.b.c'),('http://d.e.f')
ALTER TABLE new_random ADD no_https VARCHAR(500) AS (substring_index(`new_domain`,'http://',-1)), ADD KEY(no_https)
ALTER TABLE new_random ADD rev_domain VARCHAR(500) AS (REVERSE(no_https)), ADD KEY(rev_domain)
SELECT * FROM new_random
new_domain | no_https | rev_domain
:----------- | :------- | :---------
http://a.b.c | a.b.c | c.b.a
http://d.e.f | d.e.f | f.e.d
EXPLAIN SELECT new_domain FROM new_random WHERE rev_domain LIKE 'c.b.%'
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
-: | :---------- | :--------- | :--------- | :---- | :------------ | :--------- | :------ | :--- | ---: | -------: | :-----------------------
1 | SIMPLE | new_random | null | range | rev_domain | rev_domain | 2003 | null | 1 | 100.00 | Using where; Using index
db<>fiddle here
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
1
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
add a comment |
The best way to deal with domains is to use generated columns that has the reverse function on them and index this generated columns. This way a significant amount of queries can be WHERE domain LIKE CONCAT(reverse(const),'%')
and use an index.
Removing http://
in a query is also an expensive way to do this. Use this in a generated function/index too.
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`))
INSERT INTO new_random VALUES ('http://a.b.c'),('http://d.e.f')
ALTER TABLE new_random ADD no_https VARCHAR(500) AS (substring_index(`new_domain`,'http://',-1)), ADD KEY(no_https)
ALTER TABLE new_random ADD rev_domain VARCHAR(500) AS (REVERSE(no_https)), ADD KEY(rev_domain)
SELECT * FROM new_random
new_domain | no_https | rev_domain
:----------- | :------- | :---------
http://a.b.c | a.b.c | c.b.a
http://d.e.f | d.e.f | f.e.d
EXPLAIN SELECT new_domain FROM new_random WHERE rev_domain LIKE 'c.b.%'
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
-: | :---------- | :--------- | :--------- | :---- | :------------ | :--------- | :------ | :--- | ---: | -------: | :-----------------------
1 | SIMPLE | new_random | null | range | rev_domain | rev_domain | 2003 | null | 1 | 100.00 | Using where; Using index
db<>fiddle here
The best way to deal with domains is to use generated columns that has the reverse function on them and index this generated columns. This way a significant amount of queries can be WHERE domain LIKE CONCAT(reverse(const),'%')
and use an index.
Removing http://
in a query is also an expensive way to do this. Use this in a generated function/index too.
CREATE TABLE `new_random` (
`new_domain` varchar(500) NOT NULL,
PRIMARY KEY (`new_domain`))
INSERT INTO new_random VALUES ('http://a.b.c'),('http://d.e.f')
ALTER TABLE new_random ADD no_https VARCHAR(500) AS (substring_index(`new_domain`,'http://',-1)), ADD KEY(no_https)
ALTER TABLE new_random ADD rev_domain VARCHAR(500) AS (REVERSE(no_https)), ADD KEY(rev_domain)
SELECT * FROM new_random
new_domain | no_https | rev_domain
:----------- | :------- | :---------
http://a.b.c | a.b.c | c.b.a
http://d.e.f | d.e.f | f.e.d
EXPLAIN SELECT new_domain FROM new_random WHERE rev_domain LIKE 'c.b.%'
id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra
-: | :---------- | :--------- | :--------- | :---- | :------------ | :--------- | :------ | :--- | ---: | -------: | :-----------------------
1 | SIMPLE | new_random | null | range | rev_domain | rev_domain | 2003 | null | 1 | 100.00 | Using where; Using index
db<>fiddle here
edited Mar 21 at 23:38
answered Mar 21 at 23:21
danblackdanblack
2,9161420
2,9161420
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
1
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
add a comment |
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
1
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
Thanks. Can you provide a full answer with detailed syntax?
– user9371654
Mar 21 at 23:24
1
1
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
The new best way is in MySQL 8.0.13 or 14+ which supports making indexes on expressions or functions by the way.
– Raymond Nijland
Mar 21 at 23:26
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290362%2fquery-from-3-tables-lasts-forever%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Note, primary keys are a) keys and b) always unique. A secondary key on the same is unnecessary.
– danblack
Mar 21 at 23:11
Each of my tables has a primary key. What are you trying to point? I am not getting your point sorry.
– user9371654
Mar 21 at 23:20
You xxx_UNIQUE keys are not needed because the same field is a primary key.
– danblack
Mar 21 at 23:22
@danblack this does not harm. What is the problem?
– user9371654
Mar 21 at 23:23