Note that there are some explanatory texts on larger screens.

plurals
  1. POShould I use MyISAM or InnoDB Tables for my MySQL Database?
    primarykey
    data
    text
    <p>I have the following two tables in my database (the indexing is <em>not</em> complete as it will be based on which engine I use):</p> <p><strong>Table 1:</strong></p> <pre><code>CREATE TABLE `primary_images` ( `imgId` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `imgTitle` varchar(255) DEFAULT NULL, `view` varchar(45) DEFAULT NULL, `secondary` enum('true','false') NOT NULL DEFAULT 'false', `imgURL` varchar(255) DEFAULT NULL, `imgWidth` smallint(6) DEFAULT NULL, `imgHeight` smallint(6) DEFAULT NULL, `imgDate` datetime DEFAULT NULL, `imgClass` enum('jeans','t-shirts','shoes','dress_shirts') DEFAULT NULL, `imgFamily` enum('boss','lacoste','tr') DEFAULT NULL, `imgGender` enum('mens','womens') NOT NULL DEFAULT 'mens', PRIMARY KEY (`imgId`), UNIQUE KEY `imgDate` (`imgDate`) ) </code></pre> <p><strong>Table 2:</strong></p> <pre><code>CREATE TABLE `secondary_images` ( `imgId` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `primaryId` smallint(6) unsigned DEFAULT NULL, `view` varchar(45) DEFAULT NULL, `imgURL` varchar(255) DEFAULT NULL, `imgWidth` smallint(6) DEFAULT NULL, `imgHeight` smallint(6) DEFAULT NULL, `imgDate` datetime DEFAULT NULL, PRIMARY KEY (`imgId`), UNIQUE KEY `imgDate` (`imgDate`) ) </code></pre> <p>Table 1 will be used to create a thumbnail gallery with links to larger versions of the image. <code>imgClass</code>, <code>imgFamily</code>, and <code>imgGender</code> will refine the thumbnails that are shown. </p> <p>Table 2 contains images <em>related</em> to those in Table 1. Hence the use of <code>primaryId</code> to relate a single image in Table 1, with one or more images in Table 2. This is where I was thinking of using the Foreign Key ability of InnoDB, but I'm also familiar with the ability of Indexes in MyISAM to do the same.</p> <p>Without delving too much into the remaining fields, <code>imgDate</code> is used to order the results.</p> <p>Last, but not least, I should mention that this database is <em>READ ONLY</em>. All data will be entered by me. I have been told that if a database is read only, it should be MyISAM, but I'm hoping you can shed some light on what <em>you</em> would do in my situation.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload