Posted in Query on Jun 9th, 2008
The row won’t actually be inserted if it results in a duplicate key.
Syntac ::
Insert ignore into T values(a, b, c)
Insert ignore into T(a, b, c) SELECT a, b, c FROM F
NB :: The Table must have a primary key.
Read Full Post »
Posted in Query on Jun 9th, 2008
Mechanism ::
Try to insert the new row into the table
While the insertion fails because a duplicate-key error occurs for a primary key or unique index:
Delete from the table the conflicting row that has the […]
Read Full Post »
Posted in Query on May 31st, 2008
A DISTINCT and GROUP BY usually generate the same query plan, so performance should be the same across both query constructs.
Use “Group by” when you use aggregate query, and “DISTINCT” when you want to distinct values.
Essentially it is just a matter of syntax in this case, the end result should be same.
Comment ::
Many […]
Read Full Post »
Posted in Query on May 11th, 2008
There is some query that can be useful ::
SUBSTRING(str,pos) , SUBSTRING(str FROM pos) , SUBSTRING(str,pos,len) , SUBSTRING(str FROM pos FOR len)
mysql> SELECT SUBSTRING(’Quadratically’,5);
-> ‘ratically’
mysql> SELECT SUBSTRING(’foobarbar’ FROM 4);
-> ‘barbar’
Read Full Post »
Posted in Query on May 10th, 2008
PostgreSQL 7.03
Normal
autocommit on
fsync off
insert update
insert update
insert update
5:16 6:46
n/a n/a
0:10 0:18
I thing that insert is faster than the update statement, so if u have to choice that statement, u better choice an insert.
Read Full Post »