phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sumanta Gh <sumanta...@tcs.com>
Subject Auto-increment Column
Date Wed, 26 Feb 2014 10:08:27 GMT
Hi,
I have a table where an auto-increment integer field is present.
As there is no support for sequence in version 2.2.2, I am using following 
SQL statements to insert data. Tell me which one is better or is there 
anything better than this?

explain upsert into test (serial, id, val)  select 4, max(id)+1, 'test' 
from test;

+------------+
|    PLAN    |
+------------+
| UPSERT SELECT |
| CLIENT PARALLEL 1-WAY FULL SCAN OVER TEST |
|     SERVER AGGREGATE INTO SINGLE ROW |
+------------+


 explain upsert into test (serial, id, val)  select 4, id+1, 'test' from 
test order by id desc limit 1;

+------------+
|    PLAN    |
+------------+
| UPSERT SELECT |
| CLIENT PARALLEL 1-WAY FULL SCAN OVER TEST |
|     SERVER TOP 1 ROW SORTED BY [ID DESC] |
| CLIENT MERGE SORT |
+------------+


regards,
Sumanta
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Mime
View raw message