16
I have a query running on my site that is installed the Mysql 5.5.43
, but when I went up on the server (which has the MariaDB 5.5.38
and I only came to know now) the query does not return the same result, and so I wonder if someone could tell me why this wrong result and the differences between these two databases, that although they are very similar, there are their differences, or I am wrong?
Here is an example of the query I’m trying to run, remembering that in Mysql returns the correct results and in Mariadb that is not on the server:
SELECT DISTINCT umr.tema_id,
(
SELECT count(vw1.tema_id)
FROM vw_unidades_monitoramentos_respostas vw1
WHERE ((vw1.tema_id = umr.tema_id)
AND (vw1.unidade_id = 68)
AND (vw1.opt_aplicavel = 1)
AND (vw1.opt_conforme = 1)
AND (vw1.dt_validate >= '2015-07-22'))
) as conforme,
(
SELECT count(vw2.tema_id)
FROM vw_unidades_monitoramentos_respostas vw2
WHERE ((vw2.tema_id = umr.tema_id)
AND (vw2.unidade_id = 68)
AND (vw2.opt_aplicavel IS NULL))
) as naoAvaliado,
(
SELECT count(vw3.tema_id)
FROM vw_unidades_monitoramentos_respostas vw3
WHERE ((vw3.tema_id = umr.tema_id)
AND (vw3.unidade_id = 68)
AND (vw3.opt_aplicavel = 1 OR vw3.opt_aplicavel IS NULL))
) as totalAtribuido
FROM vw_unidades_monitoramentos_respostas umr
WHERE (umr.unidade_id = 68 AND (umr.opt_aplicavel = 1 OR umr.opt_aplicavel IS NULL))
Here is a print I took of the results running this query in both databases and see the difference between the two databases, remembering that the data are the same.
Follow link with a database dump for a test. https://gist.github.com/marcelod/91836c31cf4bdce5eadc
Are you sure the data is the same in both databases? Which Voce engine is using in Mysql and which Voce engine is using in Maria?
– Anthony Accioly
I’m sure it’s the same base because I downloaded the entire server base, created a new base on my localhost and put it to run.
– Marcelo Diniz
What is the difference that is giving between the results?
– bfavaretto
Are the values that are not coming correct, many of them in Mariadb comes zeroed.
– Marcelo Diniz
Marcelo, could you kindly execute the command
SHOW TABLE STATUS WHERE Name = 'vw_unidades_monitoramentos_respostas'
in both environments and post the fieldengine
of each?– Anthony Accioly
Another thing, can run the query
SELECT count(tema_id) FROM vw_unidades_monitoramentos_respostas WHERE opt_aplicavel IS NULL
in both environments and see if they return the same thing?– Anthony Accioly
@Anthonyaccioly circled the
show tables ..
and theengine
appears in both asNULL
and when running q query to return the total of tema_id gave the same thing.– Marcelo Diniz
Tries
SHOW CREATE TABLE vw_unidades_monitoramentos_respostas;
, must appear the engine at the end of the returned command.– Anthony Accioly
We both gave the same thing,
character_set_client = utf8
andcollation_connection = utf8_general_ci
. Just remembering that this is a view I have in the bank.– Marcelo Diniz
backs up these tables/records and makes available somewhere that I do the tests on my Mysql and Mariadb p/ see if it looks the same or different, so far as I know it is not p/ there is difference of Mysql->Maria, but may have difference of Maria->Mysql, ( everything you have in Mysql must run the same in Maria, but not everything in Maria runs in Mysql )
– SneepS NinjA
@Sneepsninja created a file with the creation of the tables and the necessary view with the data you need, follow the link https://gist.github.com/marcelod/91836c31cf4bdce5eadc
– Marcelo Diniz
@Marcelodiniz tested with what you passed there on the link, despite showing a small difference compared to what you posted, the results obtained in both Mysql and Mariadb are the same
– SneepS NinjA
That’s exactly what I don’t understand. I’ve done everything from removing the database and create again and still in the hosting that is where this installed Mariadb does not return me the correct result.
– Marcelo Diniz