List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 15 2002 11:42pm
Subject:Re: sorted tables and fast selects
View as plain text  
At 8:20 -0500 12/15/02, David T-G wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi, all --
>
>I think that the answer I'll get is "index", but I don't know for sure...

That's right.

>
>If I have a table with fields such as a client id number and a credit
>card id number, where a given client might have multiple cards on file,
>when I select from the table do I care about having the table sorted so
>that I can go to the client id number, get all of the ccard id numbers,
>and then know that I'm done when the client id number changes, or does it
>not matter and I just select from the whole table and get the limited
>results back?

You don't sort the table itself, you add indexes to the tables for columns
that you're likely to use for selecting and sorting.  client id number
sounds like it would be one column that you'd want to index in your
situation

>
>If I had to write this myself, I'd probably base the decision to keep the
>table sorted on the number of reads vs the number of writes, since I'd
>have to rewrite at least some of the table whenever I added a client
>card.  This is a database, though, where that's all handled for me :-)
>
>Is sorting and speed a consideration when making a select request?  Is
>that the sort of thing where an index will speed things up?

Yes.

>
>
>TIA & HAND
>
>mysql query,
>:-D
>- --
>David T-G                      * There is too much animal courage in
>(play) davidtg@stripped * society and not sufficient moral courage.
>(work) davidtgwork@stripped  -- Mary Baker Eddy, "Science and Health"
>http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Thread
sorted tables and fast selectsDavid T-G15 Dec
  • Re: sorted tables and fast selectsPeter Brawley15 Dec
    • Re: sorted tables and fast selectsDavid T-G15 Dec
  • Re: sorted tables and fast selectsPaul DuBois16 Dec
Re: sorted tables and fast selectsDavid T-G16 Dec
  • How to start & use MySQL in Windowstmb16 Dec
    • Primary Key Questiontmb16 Dec
      • re: Primary Key QuestionVictoria Reznichenko16 Dec