SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: alias question

  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    alias question

    Hi,

    where I have a table 'products' with a column (currency char (3) ) and it is constrained to reference the table 'currencies.currency', which should I query when gathering columns from the products table; c.currency or p.currency?

    if c.currency is ever updated, so will be p.currency so they should always have the same value and I reckon that if I can omit a join,. then I would have a more efficient query.

    But, am I correct?

    bazz

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    it doesn't really matter, but you MIGHT get a marginal performance improvement using p.currency, but only if you're also not retrieving any other columns from the currencies table.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  3. #3
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you longneck. :thumbsup:

    I can see why there may be little performance gain but I think a simpler query might tax my brain less

    bazz

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i frequently trade performance for simpler implementation. complexity for performance reasons can come later once the whole application is done.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •