How can you save anything by reading?

|
Balu504 2020-03-10 15:56:43
Can you please send me youtube link tq. Bcoz I didn’t find any MySQL in that channel.
madno 2020-03-10 17:16:19
289 lock struct(s), heap size 41168, 1648 row lock(s), undo log entries 2509
madno 2020-03-10 17:16:33
madno 2020-03-10 17:16:19
289 lock struct(s), heap size 41168, 1648 row lock(s), undo log entries 2509

can anyone explain this

Balu504 2020-03-10 19:57:23
Tq bro
Tushar Sharma 2020-03-14 09:32:54
mysql_en-2375.jpg
Can anyone help on this…?
Paynalton 2020-03-14 15:03:59
Tushar Sharma 2020-03-14 09:32:54
Can anyone help on this…?

Coma separated tables in FROM section

madno 2020-03-18 08:45:51
in SHOW ENGINE INNODB STATUS.. under TRANSACTIONS i found this
madno 2020-03-18 08:45:58
—TRANSACTION 844665526, ACTIVE 1 sec
21 lock struct(s), heap size 1136, 587 row lock(s), undo log entries 310
MySQL thread id 5590, OS thread handle 139905017341696, query id 166239403 ip-10-0-0-5.ec2.internal 10.0.0.5 root
madno 2020-03-18 08:47:14
madno 2020-03-18 08:45:58
—TRANSACTION 844665526, ACTIVE 1 sec
21 lock struct(s), heap size 1136, 587 row lock(s), undo log entries 310
MySQL thread id 5590, OS thread handle 139905017341696, query id 166239403 ip-10-0-0-5.ec2.internal 10.0.0.5 root

what is the lock structs,heap size,and undo log entries and it is in ACTIVE state but why it is not showing any query

sixpeteunder 2020-03-18 09:45:59
Hello, I have a strange problem. I have a status column which is INT NOT NULL and has a default value of 0.
However, when I insert NULL into this column, I get an error: “Column status cannot be null”
All the other columns with default values are behaving as they should. What could be causing this?

EDIT: Let me know if you need to see the table structure and query, and I will send them here.

MasterZiv 2020-03-18 10:51:51
madno 2020-03-18 08:47:14
what is the lock structs,heap size,and undo log entries and it is in ACTIVE state but why it is not showing any query

Because a transaction can consist of many queries and there can be a situation when there is no any query actively running at a moment.

madno 2020-03-18 10:53:54
MasterZiv 2020-03-18 10:51:51
Because a transaction can consist of many queries and there can be a situation when there is no any query actively running at a moment.

It is active until it is closed by the wait_timeout

MasterZiv 2020-03-18 10:56:07
madno 2020-03-18 08:47:14
what is the lock structs,heap size,and undo log entries and it is in ACTIVE state but why it is not showing any query

locks heap , undo — these are internal InnoDB structures.

MasterZiv 2020-03-18 10:56:16
madno 2020-03-18 10:53:54
It is active until it is closed by the wait_timeout

Possibly

MasterZiv 2020-03-18 10:57:50
sixpeteunder 2020-03-18 09:45:59
Hello, I have a strange problem. I have a status column which is INT NOT NULL and has a default value of 0.
However, when I insert NULL into this column, I get an error: “Column status cannot be null”
All the other columns with default values are behaving as they should. What could be causing this?

EDIT: Let me know if you need to see the table structure and query, and I will send them here.

Well, this is logical, as , as you have said , the field is marked as NOT NULL.
If a field is NOT NULL, you cannot put NULL in it.

sixpeteunder 2020-03-18 11:00:36
I assumed that NULL is automatically replaced with the default value…
sixpeteunder 2020-03-18 11:07:04
My intention is that the column should never be null.
MasterZiv 2020-03-18 11:07:14
sixpeteunder 2020-03-18 11:00:36
I assumed that NULL is automatically replaced with the default value…

No, Default value is used when NO VALUE is specified in INSERT statement for a field.

MasterZiv 2020-03-18 11:07:42
sixpeteunder 2020-03-18 11:07:04
My intention is that the column should never be null.

Then why do you state NULL for it ?

sixpeteunder 2020-03-18 11:08:14
MasterZiv 2020-03-18 11:07:14
No, Default value is used when NO VALUE is specified in INSERT statement for a field.

Thank you for the clarification.

sixpeteunder 2020-03-18 11:09:06
MasterZiv 2020-03-18 11:07:42
Then why do you state NULL for it ?

I’m just trying to get MySQL to pick the default value, in this particular query.

sixpeteunder 2020-03-18 11:10:28
I have not specified columns in my query, like so:

INSERT INTO table VALUES (NULL, NULL, ‘someValue’, ‘someOtherValue’)

MasterZiv 2020-03-18 11:22:02
sixpeteunder 2020-03-18 11:10:28
I have not specified columns in my query, like so:

INSERT INTO table VALUES (NULL, NULL, ‘someValue’, ‘someOtherValue’)

First, you must specify FIELDS clause explicitly, like
INSERT INTO table (field1, field2, ) values …

MasterZiv 2020-03-18 11:23:28
sixpeteunder 2020-03-18 11:10:28
I have not specified columns in my query, like so:

INSERT INTO table VALUES (NULL, NULL, ‘someValue’, ‘someOtherValue’)

Second, don’t specify NULL values for fields you don’t want to set values for. For such fields, DONT MENTION THEM AT ALL in INSERT.

Gnation88 2020-03-21 11:43:07
Please suggest a ER diagram app, want to make documentation.
MasterZiv 2020-03-22 11:30:08
Gnation88 2020-03-21 11:43:07
Please suggest a ER diagram app, want to make documentation.

Erwin, sdesigner, Visio, embarcadero er studio, pgModeler.
And many others

Verne_Rockwell 2020-03-26 13:31:18
Im getting error in triggers
piterden 2020-03-27 05:28:46
Verne_Rockwell 2020-03-26 13:31:18
Im getting error in triggers

You are the intrigger

sixpeteunder 2020-03-28 13:16:04
Something I’m building has a votes system, with a user being able to cast a single upvote or downvote.

Should I represent this in the DB as a signed tinyint column, or as an enum with +1 and -1 as the options?

MasterZiv 2020-03-28 14:08:59
sixpeteunder 2020-03-28 13:16:04
Something I’m building has a votes system, with a user being able to cast a single upvote or downvote.

Should I represent this in the DB as a signed tinyint column, or as an enum with +1 and -1 as the options?

There is no much difference how to do this, it is more the matter of taste.

roipeker 2020-03-28 22:02:38
👋 people
roipeker 2020-03-28 22:08:35
Im not fluent at all in sql …
I am wondering whats the best db design to do scrapping queues
Basically i have a table that stores a list of urls (varchar 255) and a status (tiny int) to know if its “processing, pending or completed” and a timestamp.
And i need to store the result pf that url call somewhere and update the status of that “queue” table… whats the most optimized way to do this
MasterZiv 2020-03-29 00:43:30
roipeker 2020-03-28 22:08:35
Im not fluent at all in sql …
I am wondering whats the best db design to do scrapping queues
Basically i have a table that stores a list of urls (varchar 255) and a status (tiny int) to know if its “processing, pending or completed” and a timestamp.
And i need to store the result pf that url call somewhere and update the status of that “queue” table… whats the most optimized way to do this

It’s not clear to do what?

roipeker 2020-03-29 00:43:54
MasterZiv 2020-03-29 00:43:30
It’s not clear to do what?

performance wise…

roipeker 2020-03-29 00:44:17
if i shuold save the “responses” of those urls in the same table… or a different one.
MasterZiv 2020-03-29 00:44:45
roipeker 2020-03-29 00:44:17
if i shuold save the “responses” of those urls in the same table… or a different one.

Doesn’t matter

roipeker 2020-03-29 00:44:54
doesnt?
roipeker 2020-03-29 00:44:59
insert vs read in mysql.
roipeker 2020-03-29 00:45:42
the responses of those url lists will be only INSERTED into the database… but the url table must be read and updated with the status…
roipeker 2020-03-29 00:46:05
myurl.com?id=0, status = 1 (somebody is processing)
myurl.com?id=1, status = 1
myurl.com?id=2, status = 0 (will be delivered next)
myurl.com?id=3, status = 0
MasterZiv 2020-03-29 00:46:13
roipeker 2020-03-29 00:44:17
if i shuold save the “responses” of those urls in the same table… or a different one.

I suppose your queues are going to have so little types so it all not important completely

roipeker 2020-03-29 00:46:26
little types?
MasterZiv 2020-03-29 00:46:41
roipeker 2020-03-29 00:44:59
insert vs read in mysql.

How can you save anything by reading?

roipeker 2020-03-29 00:47:11
No, what i mean is use the same table in mysql to insert the http response and read the ‘urls’
roipeker 2020-03-29 00:47:39
webpage / app will be pinging the server asking if it has “urls” to scrap…
roipeker 2020-03-29 00:47:55
so the client does all the requests and then send back data to server.
MasterZiv 2020-03-29 00:47:56
roipeker 2020-03-29 00:47:39
webpage / app will be pinging the server asking if it has “urls” to scrap…

Mo

roipeker 2020-03-29 00:48:06
that data should be stored in the same table… or different one.
roipeker 2020-03-29 00:48:30
imagine like a p2p network of people requesting my server to get urls… and posting back the content of those urls
MasterZiv 2020-03-29 00:51:29
roipeker 2020-03-29 00:48:06
that data should be stored in the same table… or different one.

In same table you will have to do update , in a different table you will have to do insert.
Both are not so complex.

|