Showing entries 1 to 2
Displaying posts with tag: rowid (reset)
Oracle query-eliminate duplicate but one using rowid

Yesterday a friend came across an oracle query problem: Consider below table: cid cname.... cdata 1 x xxxx 1 x xxxx .. 2 xzzz fjnd 3 a evddd Now the problem was cid is repeated and cdata column is having some extra characters but data is considered same (eg. xxxx & xxxx..). so when he […]

row id in MySQL and Drizzle (and the engines)

Some database engines have a fundamental concept of a row id. The row id is everything you need to know to locate a row. Common uses include secondary indexes (key is what’s indexed, value is rowid which you then use to lookup the row).

One design is the InnoDB method of having secondary indexes have the value in the index be the primary key of the row. Another is to store the rowid instead. Usually (or often… or sometimes…) rowid is much smaller than the pkey of the row. This is how innodb can answer some queries just out of the index. If it used rowid, it may involve more IO to answer the query. All this is irrelevant if you never want just the primary key from a secondary index.

Some engines are designed from the start to have rowid, others it’s added later (e.g. NDB).

Anyway… all beside the point. Did you know you can do this in mysql or drizzle:

drizzle> create table t1 (a int primary key); …
[Read more]
Showing entries 1 to 2