You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Sumanta Gh <su...@tcs.com> on 2014/02/26 11:08:27 UTC
Auto-increment Column
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