migroo Posted February 6, 2010 Share Posted February 6, 2010 What about data bases what are they made to store? I am thinking about storing several pages worth of coding in one is this a bad idea? Link to comment Share on other sites More sharing options...
Synook Posted February 6, 2010 Share Posted February 6, 2010 Databases are for storing data! You can put anything you need in them. Whether it is appropriate or not in your case depends on your system. For example, you may have a code-sharing system (e.g. like Pastebin) - you could use a database to store the snippets. Link to comment Share on other sites More sharing options...
Redroest Posted February 6, 2010 Share Posted February 6, 2010 I think he means what kind of storage a database uses. For example XML uses plain tekstfiles in principle. I am currious to haha Link to comment Share on other sites More sharing options...
boen_robot Posted February 6, 2010 Share Posted February 6, 2010 What about data bases what are they made to store?"Data" or... anything. Any kind of symbols that mean something (numbers, text, etc.). What makes them special is that you can also create relationships among different kinds of data, so that you may type the real data just once, and then just write a shorter data to reference it.For example, a page may have a category, and a category may apply to multiple pages. You can write each category name once, give it a corresponding number, then just write the category number as the category of an article. You could then use SQL to actually get the page and its category name. Should you decide to rename the category, you only need to change it once, and the next time you use SQL on a page with the same number, you'll get the new name.I am thinking about storing several pages worth of coding in one is this a bad idea?Usually, it isn't a bad idea... as long as by "pages worth of coding" you mean pages that contain code snippets or plain (X)HTML code. If you mean pages containing PHP or another kind of a server side code... it's better to rethink your approach. You should isolate your logic into PHP file(s), and place the plain contents in the database. If only portions are subject to change (e.g. a category of a page), create a separate table or field in the database for them.I think he means what kind of storage a database uses. For example XML uses plain tekstfiles in principle. I am currious to haha Usually, database contents are stored in one (or several) big, binary files, so that they can be instantly used by the database engine, instead of being "parsed" first, as doing with XML would require. Link to comment Share on other sites More sharing options...
Synook Posted February 7, 2010 Share Posted February 7, 2010 MySQL stores each table in one file (though if your table is large and using InnoDB it may split it up). Link to comment Share on other sites More sharing options...
migroo Posted February 7, 2010 Author Share Posted February 7, 2010 Okay this is awesome! By pages worth of coding I was talking about standard xhtml. Thanks for helping me understand what mysql is good for. Link to comment Share on other sites More sharing options...
Redroest Posted February 7, 2010 Share Posted February 7, 2010 So when I make multiple tables myself like:-users-modules-blocks-newsIt will make one binary file that contains this list and four binary files that contain the actual data per table? Link to comment Share on other sites More sharing options...
Synook Posted February 8, 2010 Share Posted February 8, 2010 Looks like MyISAM (what you are probably using) actually has three files per table. Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension. http://dev.mysql.com/doc/refman/5.0/en/myi...age-engine.htmlhttp://dev.mysql.com/doc/refman/5.0/en/innodb.html Link to comment Share on other sites More sharing options...
Redroest Posted February 8, 2010 Share Posted February 8, 2010 I am actually using InnoDB since that was recommanded to me a long time ago when I started normalizing the tables. I dont know what the benefits were, but I assume that it also has something to do with the way the database stores its tables in files etc.Edit: found the answer myself: Last month we looked at the HEAP table type, a table type which runs entirely in memory. This month we look at setting up the InnoDB table type, the type of most interest to serious users. The standard MyISAM table type is ideal for website use, where there are many reads in comparison to writes, and no transactions. Where these conditions do not apply (and besides websites, they do not apply often in the database world), the InnoDB table is likely to be the table type of choice. This article is aimed at users who are familiar with MySQL, but have only used the default MyISAM table type.InnoDB Features * ACID-compliant transactions. * Full referential integrity * Row-level locking * Tables are stored in a tablespace (unlike MyISAM tables where each table is a file) source: http://www.databasejournal.com/features/my...noDB-tables.htm What exactly do they mean with tablespaces? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.