It works great right now but wondering if it will slow down after tables have grown?

|
azerabshv 2020-11-21 15:40:12
yes single quota was work
thansk everyone
azerabshv 2020-11-21 15:40:26
but why did it work in localhost not in digitlaocean cluster?
piterden 2020-11-21 15:40:55
Another flavor
piterden 2020-11-21 15:41:17
DO is shit ))
azerabshv 2020-11-21 15:42:00
piterden 2020-11-21 15:40:05
SELECT `column1`, `column2` FROM `table1`, `table2` WHERE `column2` = ‘value’;

reverse quota also dont work
SELECT `id, name AS title, (SELECT COUNT(*) FROM lectures WHERE lectures.section_id=sections.id AND lectures.type<>’video’) AS resource_count FROM sections AS sections WHERE sections.course_id = ’76’;`
only single quota was work

azerabshv 2020-11-21 15:42:10
thanks everyone for help
piterden 2020-11-21 15:42:55
azerabshv 2020-11-21 15:42:00
reverse quota also dont work
SELECT `id, name AS title, (SELECT COUNT(*) FROM lectures WHERE lectures.section_id=sections.id AND lectures.type<>’video’) AS resource_count FROM sections AS sections WHERE sections.course_id = ’76’;`
only single quota was work

I didn’t tell you to reverse quota. I mean replace to single

azerabshv 2020-11-21 15:43:56
sorry i misundestand
piterden 2020-11-21 15:46:02
MasterZiv 2020-11-21 15:36:15
“video” in double quotes is name of a column.
If you need a string literal, it
should be ‘video’

Hm… I thought double quotes works in Postgre flavor only….

piterden 2020-11-21 15:47:48
azerabshv 2020-11-21 15:42:00
reverse quota also dont work
SELECT `id, name AS title, (SELECT COUNT(*) FROM lectures WHERE lectures.section_id=sections.id AND lectures.type<>’video’) AS resource_count FROM sections AS sections WHERE sections.course_id = ’76’;`
only single quota was work

Well, what do you want if you can’t even paste you query without transformations to here?

piterden 2020-11-21 15:51:59
azerabshv 2020-11-21 15:42:00
reverse quota also dont work
SELECT `id, name AS title, (SELECT COUNT(*) FROM lectures WHERE lectures.section_id=sections.id AND lectures.type<>’video’) AS resource_count FROM sections AS sections WHERE sections.course_id = ’76’;`
only single quota was work

SELECT
`id`,
`name` AS `title`,
(
SELECT COUNT(*)
FROM `lectures`
WHERE `lectures`.`section_id` = `sections`.`id`
AND `lectures`.`type` <> ‘video’
) AS resource_count
FROM `sections` AS `sections`
WHERE `sections`.`course_id` = 76;

piterden 2020-11-21 15:53:56
I’d used join and aggregate function COUNT with grouping for such query
azerabshv 2020-11-21 15:56:22
Thanks for advice i try it
I am newbie. Thats why my querys isnt good so much
I try to optimize. Thanks so much
MasterZiv 2020-11-21 18:09:45
azerabshv 2020-11-21 15:40:26
but why did it work in localhost not in digitlaocean cluster?

You must had different settings on those two DB s

MasterZiv 2020-11-21 18:10:22
piterden 2020-11-21 15:46:02
Hm… I thought double quotes works in Postgre flavor only….

They work everywhere

chonataev 2020-11-26 03:18:00
Sorry, I know English very bad. that’s why I use google translator. I have the following problem. I am creating a site where users can interact with the base. Add your data. The database contains the Products table, which contains the data of all users. How to distribute access so that everyone can change only the data that he has created. Thanks in advance
Master Yoda 2020-11-26 05:43:08
chonataev 2020-11-26 03:18:00
Sorry, I know English very bad. that’s why I use google translator. I have the following problem. I am creating a site where users can interact with the base. Add your data. The database contains the Products table, which contains the data of all users. How to distribute access so that everyone can change only the data that he has created. Thanks in advance

Make users and give permissions of “select” privileges and so on accordingly

MasterZiv 2020-11-26 10:46:42
chonataev 2020-11-26 03:18:00
Sorry, I know English very bad. that’s why I use google translator. I have the following problem. I am creating a site where users can interact with the base. Add your data. The database contains the Products table, which contains the data of all users. How to distribute access so that everyone can change only the data that he has created. Thanks in advance

I suppose this is about so called row wise security, wich is not supported by most of relational DBMS. This can be done only programmatically, by coding this access rules in each query.
DB-side code objects like views, triggers and stored procedure can help to implement this.

Usually the approach to this task is disabling direct access to the tables at all, allowing access only via views and stored procedures wich enforces the access rules , and disabling direct modification of data in the tables, allowing only modifications via stored procedures wich generate or modify access rules for created or modified rows.

Deb_575 2020-11-26 21:19:14
Hello All
Can someone tell me if clone plug-in in mysql 8 also clones mysql user & db tables? Also if using clone plug-in will be faster compared to mysqldump for database refresh. Total data dir size being 2TB.
SNIR 2020-11-28 15:26:51
Hey Everyone,
need your help,
i’m tring to build 2 queries without success:
i have got 3 tables:
1) clients with ID,NAME
2) plays with playname,playdate,stage
3) tickets with client_id,playname,playdate,seat,cost

i’m trying to find the lowerst ticket that client buy for a show, and show only the name of the show/shows.
so i come up with this:

select plays.playname,min(tickets.cost)
from tickets

inner join plays on plays.playname=tickets.playname and plays.playdate=tickets.playdate

inner join clients on tickets.cid=clients.cid
group by plays.playname;

this one return to be all shows with the must lowest ticket.
but if i have show A with ticket that cost 200
and show B with ticket that cost 100. i want to show only the B Show. but my query show all shows and the must lowest ticket price.
how can i solve it ?

second question :
if i have client that visit in stage A, in date : 12/01/20
how can i check if he didnt visit in C Stage after this date?
i need a list of this client

thanks for the help!

MasterZiv 2020-11-29 09:32:00
SNIR 2020-11-28 15:26:51
Hey Everyone,
need your help,
i’m tring to build 2 queries without success:
i have got 3 tables:
1) clients with ID,NAME
2) plays with playname,playdate,stage
3) tickets with client_id,playname,playdate,seat,cost

i’m trying to find the lowerst ticket that client buy for a show, and show only the name of the show/shows.
so i come up with this:

select plays.playname,min(tickets.cost)
from tickets

inner join plays on plays.playname=tickets.playname and plays.playdate=tickets.playdate

inner join clients on tickets.cid=clients.cid
group by plays.playname;

this one return to be all shows with the must lowest ticket.
but if i have show A with ticket that cost 200
and show B with ticket that cost 100. i want to show only the B Show. but my query show all shows and the must lowest ticket price.
how can i solve it ?

second question :
if i have client that visit in stage A, in date : 12/01/20
how can i check if he didnt visit in C Stage after this date?
i need a list of this client

thanks for the help!

That’s lowest ticket, what should this mean?

siamaksalimi2 2020-11-30 01:45:10
hi everyone
I’m creating a support ticket system and want to count the unread tickets
I’m using two tables: tickets and ticket_comments
here is the query I run to achieve this:
select
count(`tickets`.`id`) as aggregate
from
`tickets`
inner join (
select
`ticket_comments`.`ticket_id`,
MAX(`ticket_comments`.id) as max_id
from
`ticket_comments`
group by
`ticket_comments`.`ticket_id`
order by
NULL
) as `c` on `tickets`.`id` = `c`.`ticket_id`
and `tickets`.`user_read` < `c`.`max_id`
where
`tickets`.`user_id` = ?
the query works as it should.
but I want to know that is this query optimized?
it works great right now but wondering if it will slow down after tables have grown?
I have index on id , user_id , ticket_id (separately) but don’t have index on user_read

user_read is the last ticket comment that user have read so if this value is smaller than the last ticket comment then it’s considered unread

thanks in advance

david_shiko 2020-12-02 16:56:58
Hello guys. Maybe anyone know what I do wrong?
CREATE TABLE regions (id INT AUTO_INCREMENT UNIQUE, user_id INT NOT NULL, last_check DATE DEFAULT (CURRENT_DATE), FOREIGN KEY (user_id) REFERENCES users(id));error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(CURRENT_DATE), FOREIGN KEY (user_id) REFERENCES users(id))’ at line
piterden 2020-12-02 17:23:49
david_shiko 2020-12-02 16:56:58
Hello guys. Maybe anyone know what I do wrong?
CREATE TABLE regions (id INT AUTO_INCREMENT UNIQUE, user_id INT NOT NULL, last_check DATE DEFAULT (CURRENT_DATE), FOREIGN KEY (user_id) REFERENCES users(id));error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(CURRENT_DATE), FOREIGN KEY (user_id) REFERENCES users(id))’ at line

CREATE TABLE regions (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
last_check TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(id)
);

TabahiHere 2020-12-08 09:18:31
Hi everyone, I have mariadb Galera cluster with mariadb 10.5 and galera 4. It is load balanced with haproxy kept first node as master and remaining two backup. Still I am having deadlocks. Please help.
piterden 2020-12-08 09:24:26
TabahiHere 2020-12-08 09:18:31
Hi everyone, I have mariadb Galera cluster with mariadb 10.5 and galera 4. It is load balanced with haproxy kept first node as master and remaining two backup. Still I am having deadlocks. Please help.

Didn’t you think about to change your profession?

TabahiHere 2020-12-08 09:25:30
Pardon me. I don’t understand humour at all.
piterden 2020-12-08 09:27:38
Moreover you also don’t understand what information you should give to helper person for solve your problem
TabahiHere 2020-12-08 09:30:44
May be, cause I’m learning. No-one seems to have all knowledge since birth as you have.
TabahiHere 2020-12-08 09:35:01
mysql_en-6989.jpg
This is how I have configured. I have read on few blogs that if you allow writing on multiple nodes simultaneously you may get deadblocks. Still having those.

So what else I need to check?

piterden 2020-12-08 09:42:39
How do you know you have a deadlock?
TabahiHere 2020-12-08 09:49:16
I have tested it with Postman.
piterden 2020-12-08 09:58:22
And what have you seen?
piterden 2020-12-08 09:58:43
Postman can’t connect to database
piterden 2020-12-08 09:58:54
It is tool for api testing
piterden 2020-12-08 10:02:03
Anyway, what did you see in postman that you are sure it is deadlock?
TabahiHere 2020-12-08 10:06:08
mysql_en-6996.jpg

piterden 2020-12-08 10:10:23
Why do you think this is correct?
piterden 2020-12-08 10:10:45
What soft do you use on backend?
piterden 2020-12-08 10:11:15
Maybe that soft is determining wrong
|