Questions tagged [mysql-5.6]
This tag is for the questions related to the version 5.6 of mysql database.
5
votes
1answer
68 views
Can this subquery be made to use the index?
First, apologies in advance for the wall of text. I did read through every similar question/answer I could find, but either the answers didn't seem applicable to my query, or I needed more clarity to ...
4
votes
1answer
65 views
How can LIMIT 1 possibly make a query slower
Given this table in MySQL 5.6:
create table PlayerSession
(
id bigint auto_increment primary key,
lastActivity datetime not null,
player_id bigint null,
...
constraint ...
0
votes
2answers
32 views
Is there a way to limit rows in the right table of a left join to only be used once?
I am trying to identify where there was some data loss by comparing two sets of data.
The first set of data contains a truncated non-unique barcode, and a timestamp to the second, which I've found is ...
0
votes
1answer
25 views
Mysql don't use index while self joining a table with indexed criteria
When self joining a table with criteria as indexed column, mysql goes for full table scan. By changing the join order , we can able to use index .
Table schema for EmployeeDetails
EmployeeDetails | ...
0
votes
2answers
52 views
Extracting value from String in SQL
I have a SQL table with a column containing XML. It's not pretty but it is part of the project and noch changeable.
Now I need to extract a value from a specific element of this XML. Value is a ...
0
votes
0answers
35 views
Mysql Execute stmt output
This is MySQL procedure.
How can I receive the output into the variable?
this is an analyze statements in a loop.
this return many results to the code and I would like to save those results in the ...
0
votes
0answers
16 views
Select query with three where conditions is slow, but the same query with any combination of two of the three where conditions is fast [duplicate]
I have the following query:
SELECT table_1.id
FROM
table_1
LEFT JOIN table_2 ON (table_1.id = table_2.id)
WHERE
table_1.col_condition_1 = 0
AND table_1.col_condition_2 NOT IN (3, 4)
AND (table_2.id ...
0
votes
1answer
36 views
MySQL 5.6 ExtractValue XPath concat
I don't understand why extractvalue doesn't returns values of attributes when use MySQL concat function.
SET @xml = '<items>
<docHeader companyIdIssuer="company" docTypeId="2" ...
0
votes
1answer
55 views
“Can't find any matching row in the user table” after upgrading mysql from 5.6 to 5.7
I'm getting this error:
Can't find any matching row in the user table
When trying to execute this line of my CI script:
GRANT ALL PRIVILEGES ON dbname.* TO 'user'@'host' WITH GRANT OPTION;
I ...
-2
votes
1answer
34 views
Same Mysql Server Cache settings on two different servers, but different result
I have 2 VPS running MYSQL 5.6 as a DB Server, and both have the cache enabled with the below settings
have_query_cache = YES
query_cache_type = ON
query_cache_size = 16777216
query_cache_limit = ...
0
votes
1answer
27 views
MySQL Calculate percentage change of sales between years based on SUM and GROUP BY
I have a data warehouse where the SELECT (and SUM) query has the following output.
+------+-----------+-------------+------------+
| YEAR | ITEM TYPE | TOTAL_ITEMS | TOTAL_COST |
+------+-----------+-...
0
votes
0answers
18 views
installing mysql 8 next to Mysql 5.6
I would like to install mysql 8 next to existing Mysql 5.6 on my windows 10 PC.
the installer tells me that it will upgrade the 5.6 to 8. and I want them both to exists.
How can I do that?
0
votes
0answers
37 views
MySQL Range Optimization and Multipart index
Hi i'm newbie to MySQL World.
When i read about MySQL Range Optimization some of question were raised related to multipart index.
MySQL 5.7 Doc
(http://jorgenloland.blogspot.com/2011/08/mysql-range-...
0
votes
1answer
28 views
MySQL 5.7.10 Simple Query Slower than 5.6.35
I've copied a database from 5.6.35 to 5.7.10, both are MYSQL Community Server versions and for some reason my query is running really really slow. It is a InnoDB database.
5.6 is my development ...
0
votes
0answers
20 views
MySQL Lock Tables
You want to lock the three tables a, b and c, and issue the following statements:
mysql> LOCK TABLES a READ;
mysql> LOCK TABLES b READ;
mysql> LOCK TABLES c READ;
Which tables are now ...
1
vote
2answers
29 views
Is This Join Possible?
I have a couple of tables that look like this.
table_a | table_b
-------------------------
prim_key | prim_key
zero_or_one | value1
valueA | value2
valueB | value3
valueZ ...
0
votes
0answers
23 views
Why is my MySQL Decimal column rounding prematurely?
I am attempting to store large decimal values with a precision of (27,18) in a MySQL database (v5.6). With very small decimal numbers, the precision works as expected. However, when the first ...
0
votes
2answers
32 views
DECIMAL(M), The Implementation Is Permitted to Decide the Value of M
The documentation states,
In standard SQL, the syntax DECIMAL(M) is equivalent to DECIMAL(M,0).
Similarly, the syntax DECIMAL is equivalent to DECIMAL(M,0), where the
implementation is ...
0
votes
2answers
41 views
Most Efficient Data Type for Fixed Length Column
I'm just in the process of designing my database structures.
There are a number of columns that are fixed length, at least one of which is purely alphanumeric.
Hence I'm wondering:
What is (or are) ...
1
vote
1answer
32 views
MySQL priority queue and packed addons
From MySQL 5.7 Source code,
When sorting using priority queue, we cannot use packed addons.
Without PQ, we can try.
Q: Why MySQL 5.7 does not use packed addons during priority queue?
0
votes
1answer
48 views
Set binlog for Mysql 5.6 & Ubuntu16.4
in /etc/mysql/my.cnf:
[mysqld]
log_bin=mysql-bin
binlog_format=ROW
server-id=11
then on mysql client:
mysql> show variables like '%binlog%';
+-----------------------------------------+-----------...
0
votes
0answers
33 views
Why am I getting a syntax error when setting variables in MySQL 5.6?
I have tried the following:
use my_db;
SET SESSION query_cache_type=OFF;
SET @CA_FR_ID = '16';
SET @CA_EN_ID = '15';
SET @US_ID = '1';
select * from my_table where my_table.id in (@CA_FR_ID, @...
1
vote
0answers
106 views
Upgrade MySQL ZIP, from 5.6 to 8 - not working
Currently In my windows 10 machine, I am using MySQL 5.6 zip Archive version. and using HeidiSQL(zip file) as DB client.Everything working fine.
To start the server I am following these steps
cmd
&...
0
votes
2answers
55 views
Same query returns different values on repeated execution
Database in use: 5.6 (I can't use LAG function which is from mysql 8)
I have the following table structure in mysql
book_id | Version | Rating | Price
varchar(25) | Decimal(10,2)| int | ...
2
votes
1answer
32 views
java 6, mysql5.6, jersey not support emoji properly
I am trying to support emoji in my web-app. I made the needful changes in DB for utf8mb4. When I save this text "hi 😂", saved successfully. When I check in DB then its display as ? but when I run ...
0
votes
2answers
30 views
MYSQL 5.6.10 ANALYZE TABLE lock issue
I ran the analyze table command on production mysql db without knowing it would prevent me from selecting the contents of the table. This caused production site to go down :( How long can it take for ...
3
votes
3answers
128 views
MySQL 5.6 - DENSE_RANK like functionality without Order By
I have a table like this:
+------+-----------+
|caseID|groupVarian|
+------+-----------+
|1 |A,B,C,D,E |
+------+-----------+
|2 |A,B,N,O,P |
+------+-----------+
|3 |A,B,N,O,P |
+-----...
0
votes
2answers
48 views
MySQL: Comparing date using IF condition in SELECT statement
Sample data:
db1.locationDetails table
| id | locationUID | locationName |
|----|-------------|--------------|
| 1 | L0001 | Site A |
| 2 | L0002 | Site B |
| 3 | L0003 ...
0
votes
5answers
56 views
Mysql get current count till result
This is my data set:
id user_id amount added
1 1 10.00 2018-09-11
2 2 10.00 2018-09-12
3 3 10.00 2018-09-13
4 1 8.00 2018-09-14
5 2 6.00 2018-09-15
What I need ...
1
vote
2answers
50 views
SQL Query Slower On “Identical” Server
I have multiple SQL queries that are running much slower (2x-4x longer) on one development server vs another. I am using DigitalOcean and both servers were made from the same snapshot, in terms of ...
2
votes
1answer
2k views
How to uninstall MySQL 5.6 when installed by brew on macOS?
Installed MySQL by issuing the following commands:
$ brew install mysql56
$ brew services start mysql@5.6
Now I can't access it:
$ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL ...
0
votes
3answers
55 views
Query taking too long and not using index
We have an events service which returns events filtered by id and event timestamp and ordered by primary column.
There is about 1.5 GB of data in this table
query:
SELECT event.eventID, event.orgID,...
1
vote
0answers
36 views
Foreign key constraint lead to a duplicate entry in MySQL 5.7 but not 5.6
I am trying to upgrade the database from MySQL 5.6 to 5.7, so I need to test all queries that I have at the back end in MySQL 5.7. When I try to update a table, an error is reported:
SQL Error (...
-1
votes
1answer
75 views
MySQL writes probably not updating query cache
I have a strange problem.
On MySQL 5.6 I have query cache enabled, with the below settings.
The idea of caching is that whenever a write operation happens, the record is invalidated (removed) and ...
0
votes
1answer
56 views
LIMIT number of rows in a JOIN between MySQL tables
What I have
I have the following two tables in a MySQL database (version 5.6.35).
CREATE TABLE `Runs` (
`Name` varchar(200) NOT NULL,
`Run` varchar(200) NOT NULL,
`Points` int(11) NOT NULL
) ...
1
vote
1answer
450 views
What is the alternative for generated column in MySQL 5.6
I have a MySQL alter statement
ALTER TABLE `employee`
ADD `employee_name_generator` CHAR(20) GENERATED ALWAYS AS
(COALESCE(concat(`employee_name`), '^')) VIRTUAL;
This is needed for adding ...
0
votes
1answer
30 views
MySQL NOT NULL insert behavior
I am currently working with a MySQL 5.5 and want to upgrade to 5.6 or 5.7.
However I ran into strange behavior (may be mysql bug or some global default variable).
Following code works fine with 5.5, ...
3
votes
0answers
289 views
Create temporary tables in read only transaction - MYSQL 5.7
I am currently assisting with integration testing for migrating an application that currently runs against a mysql 5.5 DB to mysql 5.7. We have run into issues related to functionality that was ...
1
vote
0answers
301 views
Docker-MySQL5.6 unknown variable lower_case_table_names=1
I want to set the variable lower_case_table_names to 1 in the MySQL 5.6 docker container.
I put the variable in the my.cnf file [mysqld] under /etc/mysql in the container.
After stopping the ...
0
votes
0answers
32 views
Concurrent inserts into table leads to duplicated rows or rows that fail validation
I have 1 table where I want to insert rows but only my select count returns 0.
The ids are auto incremented.
I should also mention that the queries run from different connections, in the general_log ...
2
votes
3answers
122 views
How to get the maximum and minimum values in each group as well as their times?
Let's say I have a table MyTable with the columns Id, NumericValue and UTCTimestamp. I'm trying to group the results of my table MyTable by the hour of their timestamp and return the maximum ...
2
votes
0answers
22 views
MySQL Database Server Is Utilizing More Than 85 % Of Memory
MySQL database server is utilizing more than 85 % of memory eventhough there are only one or two connections running select statements
Memory utilization :
[root@server1 ~]# free -m
...
0
votes
0answers
17 views
MySQL Enterprise Monitor 4.0 Support
I Hope you all are doing fine.
I have a running environment of Master Slave (Switch Over & Switch Back) and Multi-Master plus Slave . Now i want to access this environment from MySQL Enterprise ...
0
votes
0answers
28 views
How to work with BLOB contents in MySQL?
I'm using a BLOB data type to store big array of bytes. Arrays are produced and consumed by C# application, but now I need to edit my BLOB in SQL language.
The question is:
How can I update just one ...
0
votes
0answers
82 views
What causes threads_running is very low?
In this case, I'm using JMeter to simulate 2000 virtual users to access back-end server concurrently, and loop execution forever.
I used database connection pool(maximum 50 connections) to connect to ...
0
votes
0answers
12 views
MySQL5.6 Master Slave Replication Not Happening from Slave Side
OS : MySQL 5.6 & RHEL 7
I have one "Master" and "Slave" Machines & I am using "MySql" and "RHEL".
After rebooting mysqld in slave side, relay log showing differentiate in log & show ...
0
votes
0answers
19 views
Mysql 5.6 Master Slave Replication on RHEL 6.5
I have one Master and Slave Machines
Actually, I was trying to create replication between these two machine Master and Slave.
But my problem is that the slave is not communicating with master and ...
0
votes
0answers
27 views
how to store OLD object in one column in json fromat inside trigger
For example:
Drop trigger if EXISTS trig_delete_test_outlet;
DELIMITER |
CREATE TRIGGER trig_delete_test_outlet AFTER DELETE ON outlets
FOR EACH ROW BEGIN
Insert into `log`.`tempdata`( data, ...
0
votes
0answers
16 views
To load less data into MySQL Innodb buffer pool
As i have four fields in a table like ,
post_user_id(int),Post_time(datetime), like_user_id(int) and like_time(datetime). As in this table,
post_user_id = User who makes posts
post_time = User when ...
0
votes
1answer
14 views
Categorywise bulk update: MySql
I have a table for article that save the category for each article.
I want to update the sort order, but categorywise using a single query.
I am using this for data migration using bulk inserts and ...