The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. January 08, 2009, 12:29:31 AM

Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: Is There Something Simpler than RDBs?  (Read 860 times)
Bompa
Administrator
Expert
*****
Offline Offline

Posts: 219


View Profile WWW
« on: July 29, 2008, 05:04:39 PM »

Until now, I have not had a need for a RDB other than what blogs and forums use,
so I know nothing of them.  All my projects have been very small, like 50,000
records and usually no more than two fields, so I've always used flat-files and
arrays or perl dbm which is just a simple hash.

Now, I might have a situation where I would have upwards of 50 million records. 
Probably only one or two fields.

It took me two hours just to install and Start mySQL on my pc and another four
hours to insert some rows.

Is there nothing in between the limited, but super simple hash and the full all out
RDB which is a whole new language to me?

 Need Help

Bompa

Logged

perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #1 on: July 29, 2008, 05:08:46 PM »

Not really my friend.

The fact that you've made it this far is great, because you have a really tiny amount to go.

Go DL and install phpMyAdmin and you'll have a fine web-based management program for your newborn DB and you'll be happy.

And that being said, there's an awful lot of smarties here about such things - if you spend 6 hours on a project like that again without asking for assistance we'll all giggle at you behind your back. Wink

You're on the right track. Grab some advil and work through it - this is DEFINITELY the right way for you to be going. Your investment is going to pay for itself big time.
Logged

If I can't be Mr. Root then I don't want to play.
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #2 on: July 29, 2008, 05:51:47 PM »

also, once you start to possibly grasp the concept of RDB, then you might start to see ways to make that 50million more manageable. Then again, you might find your stuck with your original thought.

also realize, that using a database does not neccesarily mean you are doing RDB. a single table with 50million records is not relational. basic queries of "select * from table where thing=somthing" will be simple enough to learn. Its only when you get into the relational stuff, like subselects and joins that your head will start to hurt a bit.
Logged
Bompa
Administrator
Expert
*****
Offline Offline

Posts: 219


View Profile WWW
« Reply #3 on: July 30, 2008, 02:22:10 AM »

@perk, ok ok.


also realize, that using a database does not neccesarily mean you are doing RDB. a single table with 50million records is not relational.

Right, I just didn't know what else would signify the leap from a flat file or hash up to DBs,
cuz those are DBs also.  Maybe I could have said DB server.

Quote
basic queries of "select * from table where thing=somthing" will be simple enough to learn. I

I'll be doing a lot of is pattern matching.

I got this far:

my $select="SELECT titles FROM keywords WHERE titles RLIKE 'photography' ";

and...

$pattern = 'photographic';
my $select="SELECT titles FROM keywords WHERE titles RLIKE '$pattern' ";


I'm sure I'll be bak with some questions.

Bomps


Logged

vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 679



View Profile
« Reply #4 on: July 30, 2008, 05:39:33 AM »

FWIW, I prefer LIKE and wildcards.

e.g. "SELECT * FROM foo WHERE bar LIKE '%something%';"
Logged

nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #5 on: July 30, 2008, 07:19:30 AM »

you might want to look at fulltext as well bomps.

cant post any info about it right now, but hopefully someone can chime in. im not positive how it works on short phrases though.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #6 on: July 30, 2008, 09:13:45 AM »

 Ditto FullText indicies will help out great for the job it looks like you are doing.

FWIW VS, when you wildcard '%something%' (the % in front) you lose the benefit of any applicable index - so if you're going that way, FullText is better. If you can do like this - 'something%' then you're OK.

Just sayin.

/p
Logged

If I can't be Mr. Root then I don't want to play.
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #7 on: July 30, 2008, 09:20:54 AM »

when you wildcard '%something%' (the % in front) you lose the benefit of any applicable index
i never thought about this. I knew it, without realizing it though. at some point in history I figured that %something wouldnt be able to index because indexes work left to right. I think hash indexes wont work as well with any kind of LIKE.
Logged
DangerMouse
Expert
****
Offline Offline

Posts: 177



View Profile
« Reply #8 on: July 30, 2008, 11:21:30 AM »

Sounds like an a relational database maybe the way to go in this instance, but just to throw something else into the mix check out CouchDB - http://incubator.apache.org/couchdb/ - I've been wanting to make use of it for a while, even though its not designed to be could be the most effective way to break the object->persistance mapping problem.

DM
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #9 on: July 30, 2008, 11:24:24 AM »

Couch is an interesting project DM, but in this case particularly, I'd have to recommend a pretty simple, straight up implementation of a DB so that Bomps can learn the most standardized way of doing things first.
Logged

If I can't be Mr. Root then I don't want to play.
jammaster82
Expert
****
Offline Offline

Posts: 300

bloody hacker


View Profile WWW
« Reply #10 on: July 30, 2008, 07:36:41 PM »

Bompa, what os is your lamp running on? If its debian you can
just do an apt-get install phpmyadmin from the command line.

sudo su  (to enter super user mode sorta..)
apt-get install phpmyadmin (follow the prompts)

if you did everything right you should be able to get in there and
do whatever you need by going to http://yourip/phpmyadmin.

I also recommend installing webmin, a really useful tool that will
help you to edit all those files that you may not know how to even
find on a *nix based system.

on debian it would be:

sudo su (to get into the prompt that ends with #)

apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl

download webmin by entering this command:

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.370_all.deb

and finally install with:

sudo dpkg -i webmin_1.370_all.deb

once installed, you can then go to http://yourip:10000/

webmin is a wonderful admin web app that can point you to all your php inis
adding modifying user info and anything really you want to do
on your lamp setup from a pseudo gui.. works really well.

Once your in webmin, install usermin from the wizard and then
you can easily deal with users ..   is a life saver for me ...

hope this helps it really helped me to get to the good stuff before
i understood more about it.
« Last Edit: July 30, 2008, 07:41:17 PM by jammaster82 » Logged

Of course Big Brother exists, he is the embodiment of the party..... Does he exist in the same way I exist?....... You, do not exist.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #11 on: July 30, 2008, 10:20:14 PM »

Nice JM
Logged

If I can't be Mr. Root then I don't want to play.
Bompa
Administrator
Expert
*****
Offline Offline

Posts: 219


View Profile WWW
« Reply #12 on: July 30, 2008, 10:42:07 PM »

Whoa!

Slow down guys.  Cheesy

I have only put mysql on my W2k pc here at home to learn perl DBI::mysql

Later, I will just use cpanel to install a DB and phpmyadmin will be there.

For the time being, I am just using the console to create/delete the table.
Like after I mess it up heh.

thanks for all the replies,
Bomps


Logged

perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #13 on: July 30, 2008, 10:43:14 PM »

Whoa!

Slow down guys.  Cheesy

Mark of a really fine forum right there lads, you're all the best.
Logged

If I can't be Mr. Root then I don't want to play.
Bompa
Administrator
Expert
*****
Offline Offline

Posts: 219


View Profile WWW
« Reply #14 on: July 31, 2008, 06:53:21 AM »

What I'm up to right now is adding data, but I somehow will need to know
the number of occurances of each item I add.

It's sorta like an inventory.  Should I just add the items redundently and later
just could the occurances of 'whatever' in the column?

Or should I have a second column/field for quantity and increment it if the
item is already in stock?

duh

Logged

Pages: [1] 2
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!