Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

MySQL design question

 
   Database Forums (Home) -> PHP RSS
Next:  MySQL database design  
Author Message
Neeper

External


Since: Apr 24, 2005
Posts: 9



(Msg. 1) Posted: Thu Jan 24, 2008 3:02 am
Post subject: MySQL design question
Archived from groups: comp>lang>php (more info?)

I'm creating an application for multiple cities (about 20-50 cities).
I'm not sure whether to use a single table to store for all cities'
items or break each one out into a seperate table for each city.

I know a seperate tables will be faster for searches because there
will be less records but in terms of maintenance it gets a little
messy and hectic as the list of cities will grow.

I guess it all comes down to is, the number of records I would have.
I'm not sure how many records it takes before MySQL starts to slow
down.


Please give me your thoughts.


Thanks.

 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Erwin Moller

External


Since: Aug 22, 2005
Posts: 81



(Msg. 2) Posted: Thu Jan 24, 2008 6:12 am
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Neeper wrote:
> I'm creating an application for multiple cities (about 20-50 cities).
> I'm not sure whether to use a single table to store for all cities'
> items or break each one out into a seperate table for each city.
>
> I know a seperate tables will be faster for searches because there
> will be less records but in terms of maintenance it gets a little
> messy and hectic as the list of cities will grow.
>
> I guess it all comes down to is, the number of records I would have.
> I'm not sure how many records it takes before MySQL starts to slow
> down.
>
>
> Please give me your thoughts.

Hi,

If the application is classified, as you wrote in your first post, you
might also consider using different databases for each city, with
different username/passwords.
If you don't, you should make very sure city1 cannot access data for
city2, eg by doing getname.php?cityid=2 or something like that.

To your question, if you use an index on the relevant columns on the
table, the queries are probably very fast, IF you use that indexed
column in your where-clause.

Regards,
Erwin Moller


>
>
> Thanks.

 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Toby A Inkster

External


Since: Jan 18, 2008
Posts: 40



(Msg. 3) Posted: Thu Jan 24, 2008 6:12 am
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Neeper wrote:

> I know a seperate tables will be faster for searches because there will
> be less records but in terms of maintenance it gets a little messy and
> hectic as the list of cities will grow.

Separate tables will work at a snail's pace if you want to do cross-city
searches.

Keep them in one table. Index any columns that you plan on searching or
sorting by.

> I'm not sure how many records it takes before MySQL starts to slow
> down.

I dunno -- millions? Depends on many factors.

Just make sure that you use PDO or some other cross-database programming
tool, and avoid MySQL-specific syntax nuances. That way, you can easily
port the application to another database (perhaps even a database cluster)
if your data grows out of control.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 24 days, 21:06.]

CSS to HTML Compiler
http://tobyinkster.co.uk/blog/2008/01/22/css-compile/
 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Captain Paralytic

External


Since: Apr 23, 2007
Posts: 89



(Msg. 4) Posted: Thu Jan 24, 2008 6:12 am
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 24 Jan, 09:39, Erwin Moller
wrote:
> Neeper wrote:
> > I'm creating an application for multiple cities (about 20-50 cities).
> > I'm not sure whether to use a single table to store for all cities'
> > items or break each one out into a seperate table for each city.
>
> > I know a seperate tables will be faster for searches because there
> > will be less records but in terms of maintenance it gets a little
> > messy and hectic as the list of cities will grow.
>
> > I guess it all comes down to is, the number of records I would have.
> > I'm not sure how many records it takes before MySQL starts to slow
> > down.
>
> > Please give me your thoughts.
>
> Hi,
>
> If the application is classified, as you wrote in your first post, you
> might also consider using different databases for each city, with
> different username/passwords.
> If you don't, you should make very sure city1 cannot access data for
> city2, eg by doing getname.php?cityid=2 or something like that.
>
> To your question, if you use an index on the relevant columns on the
> table, the queries are probably very fast, IF you use that indexed
> column in your where-clause.
>
> Regards,
> Erwin Moller
>
>
>
> > Thanks.

Whilst this subject has nothign to do with php, I think you have the
wrong idea about the context in which "classified" is being used.

It is calssified as in adverts being listed in categories (the
classes) rather than classified as in "top secret".
 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Captain Paralytic

External


Since: Apr 23, 2007
Posts: 89



(Msg. 5) Posted: Thu Jan 24, 2008 6:12 am
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 24 Jan, 12:26, Erwin Moller
wrote:
> Captain Paralytic wrote:
> > On 24 Jan, 09:39, Erwin Moller
> > wrote:
> >> Neeper wrote:
> >>> I'm creating an application for multiple cities (about 20-50 cities).
> >>> I'm not sure whether to use a single table to store for all cities'
> >>> items or break each one out into a seperate table for each city.
> >>> I know a seperate tables will be faster for searches because there
> >>> will be less records but in terms of maintenance it gets a little
> >>> messy and hectic as the list of cities will grow.
> >>> I guess it all comes down to is, the number of records I would have.
> >>> I'm not sure how many records it takes before MySQL starts to slow
> >>> down.
> >>> Please give me your thoughts.
> >> Hi,
>
> >> If the application is classified, as you wrote in your first post, you
> >> might also consider using different databases for each city, with
> >> different username/passwords.
> >> If you don't, you should make very sure city1 cannot access data for
> >> city2, eg by doing getname.php?cityid=2 or something like that.
>
> >> To your question, if you use an index on the relevant columns on the
> >> table, the queries are probably very fast, IF you use that indexed
> >> column in your where-clause.
>
> >> Regards,
> >> Erwin Moller
>
> >>> Thanks.
>
> > Whilst this subject has nothign to do with php, I think you have the
> > wrong idea about the context in which "classified" is being used.
>
> > It is calssified as in adverts being listed in categories (the
> > classes) rather than classified as in "top secret".
>
> Oh yes, you might be right. Smile
> Categorized might have been a clearer word.
>
> Erwin

True, but they are known as "classified ads", in both newspapers and
on things like ebay.
 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Jerry Stuckle

External


Since: Aug 11, 2004
Posts: 1367



(Msg. 6) Posted: Thu Jan 24, 2008 6:50 am
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Neeper wrote:
> I'm creating an application for multiple cities (about 20-50 cities).
> I'm not sure whether to use a single table to store for all cities'
> items or break each one out into a seperate table for each city.
>
> I know a seperate tables will be faster for searches because there
> will be less records but in terms of maintenance it gets a little
> messy and hectic as the list of cities will grow.
>
> I guess it all comes down to is, the number of records I would have.
> I'm not sure how many records it takes before MySQL starts to slow
> down.
>
>
> Please give me your thoughts.
>
>
> Thanks.
>

You'll get much better answers from database experts over in
comp.databases.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex.RemoveThis@attglobal.net
==================
 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Erwin Moller

External


Since: Aug 22, 2005
Posts: 81



(Msg. 7) Posted: Thu Jan 24, 2008 10:06 am
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Captain Paralytic wrote:
> On 24 Jan, 09:39, Erwin Moller
> wrote:
>> Neeper wrote:
>>> I'm creating an application for multiple cities (about 20-50 cities).
>>> I'm not sure whether to use a single table to store for all cities'
>>> items or break each one out into a seperate table for each city.
>>> I know a seperate tables will be faster for searches because there
>>> will be less records but in terms of maintenance it gets a little
>>> messy and hectic as the list of cities will grow.
>>> I guess it all comes down to is, the number of records I would have.
>>> I'm not sure how many records it takes before MySQL starts to slow
>>> down.
>>> Please give me your thoughts.
>> Hi,
>>
>> If the application is classified, as you wrote in your first post, you
>> might also consider using different databases for each city, with
>> different username/passwords.
>> If you don't, you should make very sure city1 cannot access data for
>> city2, eg by doing getname.php?cityid=2 or something like that.
>>
>> To your question, if you use an index on the relevant columns on the
>> table, the queries are probably very fast, IF you use that indexed
>> column in your where-clause.
>>
>> Regards,
>> Erwin Moller
>>
>>
>>
>>> Thanks.
>
> Whilst this subject has nothign to do with php, I think you have the
> wrong idea about the context in which "classified" is being used.
>
> It is calssified as in adverts being listed in categories (the
> classes) rather than classified as in "top secret".

Oh yes, you might be right. Smile
Categorized might have been a clearer word.

Erwin
 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Michael Fesser

External


Since: Mar 01, 2006
Posts: 315



(Msg. 8) Posted: Fri Jan 25, 2008 4:03 pm
Post subject: Re: MySQL design question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

..oO(Neeper)

>I'm creating an application for multiple cities (about 20-50 cities).
>I'm not sure whether to use a single table to store for all cities'
>items or break each one out into a seperate table for each city.

One table.

>I know a seperate tables will be faster for searches because there
>will be less records but in terms of maintenance it gets a little
>messy and hectic as the list of cities will grow.

There won't be much of a difference if the tables are properly indexed.

>I guess it all comes down to is, the number of records I would have.
>I'm not sure how many records it takes before MySQL starts to slow
>down.

Millions.

Micha
 >> Stay informed about: MySQL design question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
MySQL database design - I'm creating a classifieds application for multiple cities (about 20-50 cities). I'm not sure whether to use a single table to store for all cities' items or break each one out into a seperate table for each city. I know a seperate tables will be faster...

mysql question - If I write an update script, so people can upgrade their software to the newest version I've written, and since the last version I've created a new table in the database, so I want to add it, if it does not already exist, is the syntax something like ..

MySQL question, here? - I have a question about the design of a specific mysql database. My newsserver hasn't got many specific mysql related newsgroups and those who are supported don't seem to be very active. Since many of the MySQL work goes hand in hand with PHP this..

Rookie PHP/MySQL Question - In querying a database ($result=query_db("SELECT photo_dir, photo_name FROM photograph_photo WHERE photo_dir = '$dirToCheck'"); is $result an array (where I could used a "in_array() function)? Thanks, Ian

connection to mysql in question. - Using XP2, Apache2, php5.0.4 and mysql 5.0.18. All seem to be working individually but I seem to be having a problem with php files not connecting to the database. Is there an easy way to check this? Some like <?php phpinfo(); ?> TIA
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]