.. that you experts I hope can crack like a digestive
biscuit...
how does one update, or merge or whatever is right technical
term for it - a my.table from my.another table (both are
schematically identical, no foreign keys, one primary key) but..
does it a way so when there is a duplicate
so when there is a duplicate only NULLs in my.table get
updated/replaced with proper values from my.another table?
many thanks, specially for actual syntax hints.
Nothing here is easy
My best is INSERT ... SELECT ... ON DUPLICATE KEY UPDATE ...;
INSERT INTO my.table SELECT * FROM my."an
().
Best,
/ Carsten
On 08-10-2015 15:48, Richard Reina wrote:
If I insert a record into a table with an auto increment ID how can I get
that records ID value? I have read about SELECT LAST_INSERT_ID() statement,
however, do not two statements introduce the risk that another insert may
occur
If I insert a record into a table with an auto increment ID how can I get
that records ID value? I have read about SELECT LAST_INSERT_ID() statement,
however, do not two statements introduce the risk that another insert may
occur in the interum? Is there a full proof way of getting the ID
- Original Message -
From: Camilo Vieira camilo.vie...@gmail.com
Subject: Re: MySQL 5.5 Slow performance to insert
$ ./mysqltuner.pl --user root --pass abril@123
Thank you for that password :-) I don't particularly like MySQLtuner myself, it
makes assumptions about your workload
18:23:08 Transaction:
TRANSACTION 31AC5E3, ACTIVE 8 sec inserting
mysql tables in use 3, locked 3
826 lock struct(s), heap size 96696, 31241 row lock(s), undo log entries
9932
MySQL thread id 932, OS thread handle 0x7feaf0042700, query id 42396
10.180.17.252 root
insert
lock(s)
MySQL thread id 15361, OS thread handle 0x7fea5e5c2700, query id 2690080
10.180.17.252 root Copying to tmp table
insert into CONFERENCIA_ENCALHE
(data, preco_capa_informado, qtde, qtde_informada,
chamada_encalhe_cota_id, controle_conferencia_encalhe_cota_id,
movimento_estoque_id
Hi,
Your INSEERquery status is Copying to tmp table,
this means fetching rows which has to be inserted is slow.
You should tune SELECT statement in your insert query.
Adding indexes and/or simplifying query and/or .. so on.
```
---TRANSACTION 31D6D74, ACTIVE 27107 sec
mysql tables in use 8
thread id 932, OS thread handle 0x7feaf0042700, query id 42396
10.180.17.252 root
insert into movimento_estoque_cota (
ID,APROVADO_AUTOMATICAMENTE,DATA_APROVACAO,STATUS,DATA,DATA_CRIACAO,TIPO_MOVIMENTO_ID,USUARIO_ID,
QTDE,PRODUTO_EDICAO_ID,COTA_ID,ESTOQUE_PROD_COTA_ID,ORIGEM,APROVADOR_ID
Hi list,
I have some problems with INSERT INTO and UPDATE queries on a big table.
Let me put the code and explain it ...
I have copied the create code of the table. This table has more than
1500 rows.
Create Table: CREATE TABLE `radacct` (
`RadAcctId` bigint(21) NOT NULL AUTO_INCREMENT
index on
(category, productId). And, there is a case where we want to do bulk
inserts (3000 inserts) using:
INSERT INTO (id, productId, category) VALUES (‘x1’, ‘y1’, ‘z1’), (‘x2’,
‘y2’, ‘z3’) ….. ON DUPLICATE KEY productId = VALUES(productId), category =
VALUES(category)
So, when we try
Hi,
We have a basic table, which is something like :
(id varchar50, productId varchar50, category varchar50)
In this table, ID is the primary key and we have a unique index on
(category, productId). And, there is a case where we want to do bulk
inserts (3000 inserts) using:
INSERT INTO (id
(3000 inserts) using:
INSERT INTO (id, productId, category) VALUES (x1, y1, z1), (x2,
y2, z3)
.. ON DUPLICATE KEY productId = VALUES(productId), category =
VALUES(category)
So, when we try to insert 3000 rows using this syntax with a single
statement, it takes ~ 3 seconds to execute
2012/12/03 19:10 +0530, amit
Problem
mysql call mobile_series1('(99889988),(12334565)');
You are expecting MySQL to turn one string operand into twain number operands.
That does not happen, unless you use PREPARE, which, I suspect, is not part of
your homework.
--
MySQL General Mailing
On 2012-12-03 7:40 AM, amit wrote:
Hi Team,
I am not able to use multi value insert via argument in mysql stored
procedure, Please help where am I wrong. Thanks in Advance !
mysql insert into input_data1 values(),(),(),();
Query OK, 4 rows affected (0.00 sec)
*Problem*
mysql
When creating a record, the first field (KeyField)...
KeyFieldBIGINT UNSIGNED NOT NULL AUTO_INCREMENT
...is it possible to copy this auto-generated value into
another field when using the same INSERT that creates the record?
Or would I have to use an UPDATE query using LAST_INSERT_ID
...is it possible to copy this auto-generated value into
another field when using the same INSERT that creates the record?
Or would I have to use an UPDATE query using LAST_INSERT_ID()
immediately after the INSERT statement?
Thanks for any ideas you have.
Start Here to Find It Fast!™ -
http://www.US
into
another field when using the same INSERT that creates the record?
Or would I have to use an UPDATE query using LAST_INSERT_ID()
immediately after the INSERT statement?
Thanks for any ideas you have.
Start Here to Find It Fast!™ -
http://www.US-Webmasters.com/best-start-page/
$8.77 Domain
for the
current connection. Only actions taken by the current connection can
change this value.
http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id
--
Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software
connection can
change this value.
http://dev.mysql.com/doc/**refman/5.5/en/information-**
functions.html#function_last-**insert-idhttp://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id
--
Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc
At 02:44 10/17/2012, Claudio Nanni, wrote:
Take a look at TRIGGERS
C.
PS: I am curious to know why you would do that anyway
Will want this 'AssociatedWith' field to be associated
with an older records' KeyField so I can search for a
group of records by this field.
Start Here to Find It
At 02:44 10/17/2012, Claudio Nanni wrote:
Take a look at TRIGGERS
C.
Thanks Claudio.
I wrote a trigger that MySQL accepted. However, when
I tried to insert a new record:
Can't update table 'tbl' in stored function/trigger
because it is already used by statement which invoked
but select and insert also at times,
The database size will be estimated to be about 5GB.
I need to know is this a classic case for a NOSQL database or mysql is a
good option.
Also , if i need to do 'group by', on a column on a large table what should
i keep in mind, is it advisable,
Please advice
, and hence i am asking this on mysql forum first.
I am designing a solution which will need me to import from CSV, i am using
my JAVA code to parse. CSV file has 500K rows, and i need to do it thrice
an hour, for 10 hours a day.
The Queries will mainly be update but select and insert also at times
Let's see
SHOW CREATE TABLE ...
SELECT ...
It sounds doable with MySQL; might be too big for NOSQL.
-Original Message-
From: abhishek jain [mailto:abhishek.netj...@gmail.com]
Sent: Friday, June 15, 2012 1:57 AM
To: mysql@lists.mysql.com
Subject: Which Database when lot of insert
2012/06/15 18:14 +0900, Tsubasa Tanaka
try to use `LOAD DATA INFILE' to import from CSV file.
http://dev.mysql.com/doc/refman/5.5/en/load-data.html
Try is the operative word: MySQL s character format is _like_ CSV, but not
the same. The treatment of NULL is doubtless the biggest
-Original Message-
From: Andrés Tello [mailto:mr.crip...@gmail.com]
Sent: May 12, 2012 10:08 AM
To: mysql
Subject: Mysql is toying me... why sometimes an insert or update can be
slow!? I getting bald cuz this
While doning a batch process...
show full processlist show:
| 544
is accountid a number or varchar column
On Sat, May 12, 2012 at 7:38 PM, Andrés Tello mr.crip...@gmail.com wrote:
While doning a batch process...
show full processlist show:
| 544 | prod | 90.0.0.51:51262 | tmz2012 | Query |6 |
end | update `account` set
for each month for 5 years..
I gain a lot of speed with the partitioning and sql adjustments, but I
think I lost a lot of speed at the insert...
The database stats are like 95% reading 5% writting...but that 5% is mostly
done in a batch process who happends to be done inside a time window...
I know
lost a lot of speed at the insert...
The database stats are like 95% reading 5% writting...but that 5% is
mostly done in a batch process who happends to be done inside a time
window...
I know I need to do more profiling, but... at least for now dev team is
updating the batch process from long
- Original Message -
From: Ananda Kumar anan...@gmail.com
If numeric, then why are u using quotes. With quotes, mysql will
ignore the index and do a full table scan
Will it? Common sense dictates that it would convert to the column's native
type before comparing; and a quick explain
I used to have these issues in mysql version 5.0.41.
On Mon, May 14, 2012 at 8:13 PM, Johan De Meersman vegiv...@tuxera.bewrote:
- Original Message -
From: Ananda Kumar anan...@gmail.com
If numeric, then why are u using quotes. With quotes, mysql will
ignore the index and do a
While doning a batch process...
show full processlist show:
| 544 | prod | 90.0.0.51:51262 | tmz2012 | Query |6 |
end | update `account` set `balance`= 0.00 +
'-4000' where accountid='2583092'
No other process, lo locking no nothing...
so you take this same
--
*From:* Johnny Withers joh...@pixelated.net
*To:* Neil Tompkins neil.tompk...@googlemail.com
*Cc:* [MySQL] mysql@lists.mysql.com
*Sent:* Monday, October 10, 2011 4:13 PM
*Subject:* Re: Fwd: Large insert query gives MySQL server gone away
Max packet size?
On Oct 10, 2011 6:12 PM, Neil Tompkins
change
that value in both server and client
--
*From:* Johnny Withers joh...@pixelated.net
*To:* Neil Tompkins neil.tompk...@googlemail.com
*Cc:* [MySQL] mysql@lists.mysql.com
*Sent:* Monday, October 10, 2011 4:13 PM
*Subject:* Re: Fwd: Large insert query gives MySQL
:* [MySQL] mysql@lists.mysql.com
*Sent:* Monday, October 10, 2011 4:13 PM
*Subject:* Re: Fwd: Large insert query gives MySQL server gone away
Max packet size?
On Oct 10, 2011 6:12 PM, Neil Tompkins neil.tompk...@googlemail.com
wrote:
As per the subject we've a large insert query
:* Re: Fwd: Large insert query gives MySQL server gone away
Max packet size?
On Oct 10, 2011 6:12 PM, Neil Tompkins neil.tompk...@googlemail.com
mailto:neil.tompk...@googlemail.com
wrote:
As per the subject we've a large insert query that gives up
As per the subject we've a large insert query that gives up the error MySQL
server has gone away when we try to execute it. Any ideas why ?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Max packet size?
On Oct 10, 2011 6:12 PM, Neil Tompkins neil.tompk...@googlemail.com
wrote:
As per the subject we've a large insert query that gives up the error
MySQL server has gone away when we try to execute it. Any ideas why ?
--
MySQL General Mailing List
For list archives: http
4:13 PM
Subject: Re: Fwd: Large insert query gives MySQL server gone away
Max packet size?
On Oct 10, 2011 6:12 PM, Neil Tompkins neil.tompk...@googlemail.com
wrote:
As per the subject we've a large insert query that gives up the error
MySQL server has gone away when we try to execute it. Any
On Mon, Sep 19, 2011 at 04:00, Hank hes...@gmail.com wrote:
I agree with Brandon's suggestions, I would just add when using numeric
types in PHP statements where you have a variable replacement, for instance:
$sql=INSERT into table VALUES ('$id','$val');
where $id is a numeric variable
$sql=INSERT into table VALUES ( . (int)$id . ,' .
mysql_real_escape_string($val) . ');
or using a abstraction-layer (simple self written class)
$sql=INSERT into table VALUES ( . (int)$id . ,' .
$db-escape_string($val) . ');
all other things in the context of hand-written queries are all
trapping to catch both types of errors and alert me to them. I prefer the
errors to be logical ones and not syntax errors.
$sql=INSERT into table VALUES ( . (int)$id . ,' .
mysql_real_escape_string($val) . ');
or using a abstraction-layer (simple self written class)
$sql=INSERT into table VALUES
won't. In either case, I have error
trapping to catch both types of errors and alert me to them. I prefer the
errors to be logical ones and not syntax errors.
$sql=INSERT into table VALUES ( . (int)$id . ,' .
mysql_real_escape_string($val) . ');
or using a abstraction-layer (simple self
On Mon, Sep 19, 2011 at 18:11, Reindl Harald h.rei...@thelounge.net wrote:
it is not because it is clear that it is sanitized instead hope and pray
thousands of layers somewhere else did it - for a inline-query the best
solution, if you are using a framework you will never have the insert
Best of both worlds:
$username=$_POST['username'];
// do some stuff with username here
$M=array(); // Array of things to be inserted into MySQL
$M[username]=mysql_real_escape_string($username); // Everything that
goes into $M is escaped
$query=INSERT INTO table (username) VALUES ('{$M
is escaped
$query=INSERT INTO table (username) VALUES ('{$M[username]}');
I'm not sure I'm seeing why, in particular, you are using an array here?
I want to be sure that all variables in the query are escaped. I don't
trust myself or anyone else to do this to every variable right before
the query
($username); // Everything that
goes into $M is escaped
$query=INSERT INTO table (username) VALUES ('{$M[username]}');
I'm not sure I'm seeing why, in particular, you are using an array here?
I want to be sure that all variables in the query are escaped. I don't
trust myself or anyone else to do
]=mysql_real_escape_string($username);
You're just complicating things with the addition of an unneeded array. It
seems much simpler and less cluttered to just do:
$someVar=mysql_real_escape_string($someVar);
before your insert. All you are doing is changing $someVar to $M[...]
and then using $M
that right before the query anyway with:
$M[username]=mysql_real_escape_string($username);
You're just complicating things with the addition of an unneeded array. It
seems much simpler and less cluttered to just do:
$someVar=mysql_real_escape_string($someVar);
before your insert. All you
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote:
i would use a samll class holding the db-connection with insert/update-methods
pass the whole record-array, lokk what field types are used in the table
and use intval(), doubleval() or mysql_real_escape-String
so you
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote:
i would use a samll class holding the db-connection with insert/update-methods
pass the whole record-array, lokk what field types are used in the table
and use intval(), doubleval() or mysql_real_escape-String
Am 20.09.2011 01:23, schrieb Dotan Cohen:
On Tue, Sep 20, 2011 at 01:48, Reindl Harald h.rei...@thelounge.net wrote:
i would use a samll class holding the db-connection with
insert/update-methods
pass the whole record-array, lokk what field types are used in the table
and use intval
fields in quotes as well, although it is
not necessary:
UPDATE mytable SET int_field = '5' WHERE id = '3';
On 9/18/11 5:00 AM, Dotan Cohen wrote:
I am somewhat confused as to the proper way to place quotes around
arguments in INSERT and SELECT statements. I also don't see where this
is made explicit
On Sun, Sep 18, 2011 at 17:44, Brandon Phelps bphe...@gls.com wrote:
Personally I don't use any quotes for the numeric types, and single quotes
for everything else. Ie:
Thanks, Brandon. I understand then that quote type is a matter of
taste. I always use double quotes in PHP and I've only
when using numeric
types in PHP statements where you have a variable replacement, for instance:
$sql=INSERT into table VALUES ('$id','$val');
where $id is a numeric variable in PHP and a numeric field in the table,
I'll include the $id in single quotes in the PHP statement, so even if the
value
Am 19.09.2011 03:00, schrieb Hank:
I agree with Brandon's suggestions, I would just add when using numeric
types in PHP statements where you have a variable replacement, for instance:
$sql=INSERT into table VALUES ('$id','$val');
where $id is a numeric variable in PHP and a numeric field
Hi all,
I can't explain strange behaviour of the INSERT statement in the stored
procedure.
The idea is to generate a list based on the output of 3 INNER JOIN of
regularly updated tables.
Something like :
INSERT INTO storage
(column list)
SELECT
column list
FROM t1 JOIN t2
ON t1.x=t2.y
JOIN t3
It seems to me that your insert statement is trying to insert duplicate rows
into the storage table. This is why insert ignore and replace work.
On Jul 9, 2011 3:49 AM, Igor Shevtsov nixofort...@googlemail.com wrote:
Hi all,
I can't explain strange behaviour of the INSERT statement in the stored
That's what is bad of SP in MySQL, debugging.
Just out of the blue,
can you try to disable query cache?
*SET GLOBAL query_cache_size = 0;*
*
SET GLOBAL query_cache_type = 0;
*
it could be a bug
Claudio
2011/7/9 Johnny Withers joh...@pixelated.net
It seems to me that your insert
Thanks Johnny,
In this case I wouldn't be able to insert a completely new row but
replace the existent one, so row count would stay the same.
This is a storage table with the only unique constraints on:
dda_debits_id column.
the test data is very small, so I would've noticed any duplicates
Should it be null?
INSERT INTO `friendlyCMS`.`log` (`idlog`, `imepriimek`, `clock`,
`action`, `onfile`, `filesize`) VALUES (NULL, $_COOKIE['user'],
CURRENT_TIMESTAMP, 'saved',$filename, filesize($filename));
idlog is primaryk ey auto inrement not null...
When insertin the value what should I pass
when INSERT for auto increment]
Should it be null?
INSERT INTO `friendlyCMS`.`log` (`idlog`, `imepriimek`, `clock`,
`action`, `onfile`, `filesize`) VALUES (NULL, $_COOKIE['user'],
CURRENT_TIMESTAMP, 'saved',$filename, filesize($filename));
idlog is primaryk ey auto inrement not null...
When
since your listing the columns, you could just leave off `idlog` from
the named columns and thus not also need to include the null in the
inserted values.
INSERT INTO `friendlyCMS`.`log`
(`imepriimek`, `clock`, `action`, `onfile`, `filesize`)
VALUES ($_COOKIE['user'], CURRENT_TIMESTAMP, 'saved
, 2011 6:33 AM
To: mysql@lists.mysql.com
Subject: Insert data in one table from Another Problem
Dear all,
Today I am puzzled around a problem of inserting data into new table in
new format. I have a table named *user_news* as :
We have four rows with respect to each record_id.
fore.g : I have
Dear all,
Today I am puzzled around a problem of inserting data into new table in
new format. I have a table named *user_news* as :
We have four rows with respect to each record_id.
fore.g : I have listed main columns as
*record_id field_name field_value*
572SOI
Hi!
Andre Polykanine wrote:
Hello Rolando,
So if I do
INSERT IGNORE INTO `Votes` SET `EntryId`='12345', UserId`='789';
it *won't* insert the second row if there's a row with EntryId set to
12345 and UserId set to 789?
If you want to have at most one vote per user on any entry, IMO you
Hi all,
Thanks for your fast answer to my last question!
Here's one more problem I commonly deal with.
There are cases when I need to insert the row only if such a row
doesn't exist, otherwise I need either to update the row or to do
nothing, just skip the query.
The common case
Instead of insert into you can use replace into.
--
João Cândido de Souza Neto
Andre Polykanine an...@oire.org escreveu na mensagem
news:1621362474.20110214201...@oire.org...
Hi all,
Thanks for your fast answer to my last question!
Here's one more problem I commonly deal
Be Careful. REPLACE INTO mechanically does DELETE and INSERT under mysqld's
hood.
If you want to do nothing if row exists already then do:
INSERT IGNORE instead of REPLACE INTO
Rolando A. Edwards
MySQL DBA (SCMDBA)
155 Avenue of the Americas, Fifth Floor
New York, NY 10013
212-625-5307 (Work
Hello Rolando,
Sorry, but if I do INSERT IGNORE INTO, then I must indicate a key
(typically a unique key or a primary key), or is it false? But I don't
know that key and no way to get it without more queries...
--
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http
If the table has Primary and/or UNIQUE Keys, then you are fine.
You do not need to know what they are. If you want to see them do this:
SHOW CREATE TABLE Votes\G
INSERT IGNORE INTO does not require ON DUPLICATE KEY options.
After all, you said earlier that you want to do nothing if the row
Hello Rolando,
So if I do
INSERT IGNORE INTO `Votes` SET `EntryId`='12345', UserId`='789';
it *won't* insert the second row if there's a row with EntryId set to
12345 and UserId set to 789?
Thanks and sorry!)
--
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org
insert ID
Seeing from later posts that you're using InnoDB, why don't you simply
wrap the INSERT/UPDATE into a transaction? You don't avoid the UPDATE,
but I'm not sure I understand the need to mess w/ triggers.
BEGIN
INSERT INTO t(id) NULL
UPDATE t SET xxx=last_insert_id()
COMMIT
[JS] I'll have
-Original Message-
From: Donovan Brooke [mailto:li...@euca.us]
Sent: Friday, January 21, 2011 7:28 PM
Cc: mysql@lists.mysql.com
Subject: Re: CURRENT insert ID
Just an idear..
Don't auto_increment the main table.. create a unique Id table,
auto_increment that, and grab that value first
On 24/01/2011 15:42, Jerry Schwartz wrote:
-Original Message-
From: Donovan Brooke [mailto:li...@euca.us]
Sent: Friday, January 21, 2011 7:28 PM
Cc: mysql@lists.mysql.com
Subject: Re: CURRENT insert ID
Just an idear..
Don't auto_increment the main table.. create a unique Id table
2011/1/21 Jerry Schwartz je...@gii.co.jp:
-Original Message-
From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
Sent: Friday, January 21, 2011 12:47 PM
To: mysql@lists.mysql.com
Subject: Re: CURRENT insert ID
Ok, you must have your own reasons to do that.
The fact is: You
Seeing from later posts that you're using InnoDB, why don't you simply
wrap the INSERT/UPDATE into a transaction? You don't avoid the UPDATE,
but I'm not sure I understand the need to mess w/ triggers.
BEGIN
INSERT INTO t(id) NULL
UPDATE t SET xxx=last_insert_id()
COMMIT
Best,
/ Carsten
Den
ehr...
Den 23-01-2011 15:36, Carsten Pedersen skrev:
Seeing from later posts that you're using InnoDB, why don't you simply
wrap the INSERT/UPDATE into a transaction? You don't avoid the UPDATE,
but I'm not sure I understand the need to mess w/ triggers.
BEGIN
INSERT INTO t(id) NULL
UPDATE t
Here it is in a nutshell:
I have a field that needs to be set equal to the auto-increment ID as a record
is entered. I don’t know how to do this without a subsequent UPDATE (which I
can do with a trigger). Is there any way to avoid the cost of an UPDATE?
Here’s a more concrete
I think an ON INSERT TRIGGER would take care of this; can't think of
any other way. Using last_insert_id() in the argument list would
likely yield you the previous value (which might not even related to
your table.
Having siad that.. odd requirement.
- michael dykman
ps -- sorry
-Original Message-
From: Michael Dykman [mailto:mdyk...@gmail.com]
Sent: Friday, January 21, 2011 11:50 AM
To: MySql
Subject: Re: CURRENT insert ID
I think an ON INSERT TRIGGER would take care of this; can't think of
any other way. Using last_insert_id() in the argument list would
likely
-Original Message-
From: Jerry Schwartz [mailto:je...@gii.co.jp]
Sent: Friday, January 21, 2011 11:56 AM
To: 'Michael Dykman'; 'MySql'
Subject: RE: CURRENT insert ID
-Original Message-
From: Michael Dykman [mailto:mdyk...@gmail.com]
Sent: Friday, January 21, 2011 11:50 AM
I made a typo in my previous message.
-Original Message-
From: Jerry Schwartz [mailto:je...@gii.co.jp]
Sent: Friday, January 21, 2011 12:20 PM
To: 'Jerry Schwartz'; 'Michael Dykman'; 'MySql'
Subject: RE: CURRENT insert ID
-Original Message-
From: Jerry Schwartz [mailto:je
I can´t think about how useful for you would be to have two fields with the
same value.
--
João Cândido de Souza Neto
Jerry Schwartz je...@gii.co.jp escreveu na mensagem
news:007501cbb98a$177acba0$467062e0$@co.jp...
Here it is in a nutshell:
I have a field that needs to be set equal to the
@Joao - I'm currently building a database out right now that has this
scenario. One field can be the primary key, that has a purpose for holding
the record id, another field can hold the value. Let say there are two
fields, id, s_id. Initially, you insert a record and `id` is now 100 and you
, id, s_id. Initially, you insert a record and `id` is now 100 and you
update s_id to be 100. But for whatever reason, later down the road you
need s_id to be 200. You can just update the s_id field instead of deleting
the entire record and inserting an entire new one with X amount of fields
insert ID
-Original Message-
From: Michael Dykman [mailto:mdyk...@gmail.com]
Sent: Friday, January 21, 2011 11:50 AM
To: MySql
Subject: Re: CURRENT insert ID
I think an ON INSERT TRIGGER would take care of this; can't think of
any other way. Using last_insert_id() in the argument list would
-Original Message-
From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
Sent: Friday, January 21, 2011 12:47 PM
To: mysql@lists.mysql.com
Subject: Re: CURRENT insert ID
Ok, you must have your own reasons to do that.
The fact is: You can´t set the auto_incremente value field
-Original Message-
From: Michael Dykman [mailto:mdyk...@gmail.com]
Sent: Friday, January 21, 2011 1:27 PM
To: Jerry Schwartz
Cc: MySql
Subject: Re: CURRENT insert ID
You don't need to do an update:
...
new.xxx = new.id
...
[JS] I wish it were that easy. new.id is null until after
Just an idear..
Don't auto_increment the main table.. create a unique Id table,
auto_increment that, and grab that value first for use with both fields
in your main table.
Donovan
--
D Brooke
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
''
) ENGINE=InnoDB;
INSERT INTO _sequence
VALUES ('dupkey', 0);
DELIMITER //
CREATE TRIGGER befins_dupkey BEFORE INSERT ON dupkey FOR EACH ROW
BEGIN
DECLARE v_id INT UNSIGNED;
UPDATE _sequence SET Value = (LAST_INSERT_ID(Value+1)) where name = 'dupkey';
SET NEW.id := LAST_INSERT_ID
wagnerbianch...@gmail.com
wrote:
Friends, I did a benchmark regarding to this subject.
Please, I am considering your comments.
= http://wbianchi.wordpress.com/2010/11/30/insert-x-insert-delayed/
Best regards.
--
WB
2010/11/30 Wagner Bianchi wagnerbianch...@gmail.com
://wbianchi.wordpress.com/2010/11/30/insert-x-insert-delayed/
Best regards.
--
WB
2010/11/30 Wagner Bianchi wagnerbianch...@gmail.com
Maybe, the table in use must be a table that is inside cache now - SHOW
OPEN TABLES, controlled by table_cache, I mean.
Well, if the amount of data
the MyISAM insert-while-selecting at the end of a
continguous table may well apply.
No guarantees, though - I'm not that hot on this depth.
On Tue, Nov 30, 2010 at 8:46 AM, WLGades wlga...@gmail.com wrote:
What I'm confused by though, is this line.
Note that INSERT DELAYED is slower than a normal
Maybe, the table in use must be a table that is inside cache now - SHOW OPEN
TABLES, controlled by table_cache, I mean.
Well, if the amount of data trasactioned is too small as a simple INSERT,
you don't have to be worried, I suggest. If you partition the table, we must
a benchmark to know
Friends, I did a benchmark regarding to this subject.
Please, I am considering your comments.
= http://wbianchi.wordpress.com/2010/11/30/insert-x-insert-delayed/
Best regards.
--
WB
2010/11/30 Wagner Bianchi wagnerbianch...@gmail.com
Maybe, the table in use must be a table that is inside
...@gmail.comwrote:
Friends, I did a benchmark regarding to this subject.
Please, I am considering your comments.
= http://wbianchi.wordpress.com/2010/11/30/insert-x-insert-delayed/
Best regards.
--
WB
2010/11/30 Wagner Bianchi wagnerbianch...@gmail.com
Maybe, the table in use must
, I'm to lazy to do it myself, what did you think :-p
On Tue, Nov 30, 2010 at 4:01 PM, Wagner Bianchi wagnerbianch...@gmail.com
wrote:
Friends, I did a benchmark regarding to this subject.
Please, I am considering your comments.
= http://wbianchi.wordpress.com/2010/11/30/insert-x-insert
I'm adding a table to our site that logs all page loads. In the past, when
I built this, I used MyISAM and INSERT DELAYED. I went back to look at the
documentation to see if I should still do this, and saw this (taken from
http://dev.mysql.com/doc/refman/5.1/en/insert-delayed.html):
Note
1 - 100 of 2077 matches
Mail list logo