SearchWiki
NoSQL.RecentChanges
Edit Page
Page Revisions
Groups available

CSA
Calendar
Main
NoSQL
People
PmWiki
PmWikiIt
PtvDev
RssFeeds
ScriptaVox
ScriptaWeb
ScriptaWiki

Quick links

TextFormattingRules
Edit Menu

Campaigns

  1. How do I modify existing tables?
  2. Will NoSQL ever provide record-level locking and update facilities?

How do I modify existing tables?

There are several ways:
  • Do it manually with the 'edittable' operator.
  • Simply append the new record(s) (table2) to the old table (table1):

             tail +2 < table2 >> table1

  • On large, indexed tables you can apply the changes to a smaller journalling table (edit buffer) and then use the 'update' operator. See page BigTables for more details on this method.
  • Use the old table header to build a valid new record, modify the fields of the latter, and write the modified table back to disk:

             addrow < table | compute \
             'if($0 ~ /^\t+$/) Column1="value1"; Column2="value2"; ...' \
             > table.tmp
             mv table.tmp table

  • To delete records, use the 'getrow' operator to select only those records that you want to retain:

             getrow 'selection expression' < table > table.tmp
             mv table.tmp table

  • Use the 'update' operator. The two tables are assumed to have the respective primary key fields in their leftmost columns.

Will NoSQL ever provide record-level locking and update facilities?

NoSQL assumes that tables are collections of variable-length records. Strictly speaking, record-level updates require fixed-length records. They can be done by right-padding the records with blanks to 'make room' for updates, but that is a bit of a kludge, IMHO. If you need such facilities you should use either /rdb or Starbase, or resort to a more usual SQL DBMS, either free or commercial. See also the workaround outlined in page BigTables. In fact I am thinking of a mechanism to provide some form of record-level facilities, but in a way that is in accordance with the underlying paradigm of variable-length records.

<< SpeedTests | NoSQL.DocumentationIndex | >>

Edit Page - Page Revisions - WikiHelp - SearchWiki - RecentChanges - Printable version
Page last modified on August 15, 2004, at 17:00 (CEST)