Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7720239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:37:14+00:00 2026-06-01T03:37:14+00:00

I am attempting to improve the performance of a program that tracks the most

  • 0

I am attempting to improve the performance of a program that tracks the most popular paths taken through a website. a given URL is registered in table sessionpage with a unique_id:

+-----------+--------------------------+---------------------+
| unique_id | page_url                 | mod_date_stamp      |
+-----------+--------------------------+---------------------+
|      2378 | /resources/series75.html | 2008-10-03 22:49:00 |
+-----------+--------------------------+---------------------+

Then another table, session, counts the number of hits for a set of up to 5 urls using the unique_id from sessionpage.

session

+-----------+---------+-----------------+-----------+---------------------+-------
| unique_id | counter | sequence_length | yearmonth | mod_date_stamp      | page1 | 
+-----------+---------+-----------------+-----------+---------------------+-------
|         1 |       2 |               2 |    201203 | 2012-03-28 15:42:38 |  5298 |  
+-----------+---------+-----------------+-----------+---------------------+-------

+-------+-------+-------+-------+
page2 | page3 | page4 | page5 |
+-------+-------+-------+-------+
6075 |     0 |     0 |     0 |
+-------+-------+-------+-------+

Right now, the stats program is fetching the unique_id from session page for each URL, which is taking way too long. I want to join sessionpage back to session multiple times so that the page1 – page5 fields show the url path (or 0/null) rather than the unique_id from sessionpage to speed up the program.

The end result should look like:

+-----------+---------+-----------------+-----------+---------------------+-------
| unique_id | counter | sequence_length | yearmonth | mod_date_stamp      | page1 | 
+-----------+---------+-----------------+-----------+---------------------+-------
|         1 |       2 |               2 |    201203 | 2012-03-28 15:42:38 |  /path/index.html |  
+-----------+---------+-----------------+-----------+---------------------+-------

+-------+-------+-------+-------+
page2            | page3 | page4 | page5 |
+-------+-------+-------+-------+
/path3/disk.html |     0 |     0 |     0 |
+-------+-------+-------+-------+

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:37:15+00:00Added an answer on June 1, 2026 at 3:37 am

    Based on your comment that page1, page2.. are foreign keys columns, I think it’s simple.

    Something like:

    SELECT 
        s.unique_id, s.counter, s.sequence_length, s.yearmonth, 
        s.mod_date_stamp,
        pg1.page_url as page1, pg2.page_url as page2, 
        pg3.page_url as page3, pg4.page_url as page4, 
        pg5.page_url as page5
    FROM 
        session s
    LEFT JOIN 
        sessionpage pg1 ON pg1.unique_id = s.page1 
    LEFT JOIN 
        sessionpage pg2 ON pg2.unique_id = s.page2
    LEFT JOIN 
        sessionpage pg3 ON pg3.unique_id = s.page3
    LEFT JOIN 
        sessionpage pg4 ON pg4.unique_id = s.page4
    LEFT JOIN 
        sessionpage pg5 ON pg5.unique_id = s.page5
    

    I think this will work.

    But when there is no value on column (on table session), you should use null instead of 0 (zero).

    Another tip, on the SELECT statement, if you don’t want NULL values you can use:

    COALESCE(pg5.page_url, ' ') as page5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update - Please see update below. I'm attempting to improve the performance of our
Attempting to print out a list of values from 2 different variables that are
Attempting to make a NSObject called 'Person' that will hold the login details for
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
Currently migrating from SQL Server to PostgreSQL and attempting to improve a couple of
Attempting to create a filter select to find schedules with coursedates within a given
I'm attempting to improve my MVVM abilities in my next WP7 App (which is
I'm attempting to improve the usability of a client's SharePoint deployment via JQuery; and
I am attempting to generate map overlay images that would assist in identifying hot-spots,
I am attempting to create a SVG Pie Graph that is 277 degrees. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.