Performance in MySQL query

Monday, May 5, 2014

I'm building an simple voting, unique viewer, unique download count Etc. function in php/mysql and I have one question regarding performance:

Due of many action on this small system I want to know what is the best practice on this, using multiple INT columns or 1 single VARCHAR column, of course in performance terms.

$uniqueid= STRING generated from system (ip, cookies Etc)
$contentid = INT ID on primary key of content table
$contenttype = INT 0-n ( comment = 0, poll = 1, filedownload = 2 Etc).
$action = INT 0-n ( vote = 0, view = 1, download = 2 Etc)

FROM `table`
WHERE `uid` = '$uniqueid' AND `cid` = '$contentid' AND `ct` = '$contenttype' AND `action` = '$action' ;


$key = "$uniqueid-$contentid-$contenttype-$action";

FROM `table`
WHERE `key` = '$key';

Tkank You.