DROP TEMP TABLES

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jay

    DROP TEMP TABLES

    Hey there,
    I have a question. Is it possible to to construct something through
    a combination of php and javascript that (when a browser window is
    closed) would drop temp tables that are used? I've tried to use an
    override of the SESSION functions, but that isn't working in the way I
    would like it to. I go into mysql and can see that the temp tables that
    were created for the user are still in the database. Also, I would have
    liked to have used mysql's temp tables, but those tables don't seem to
    be maintained across different pages in one session. When a user goes
    from one page to another, those temp tables are gone. Any suggestions?

    -Jay
    (patel at cs dot utk dot edu)

  • Oli Filth

    #2
    Re: DROP TEMP TABLES

    Jay said the following on 14/10/2005 14:57:[color=blue]
    > Hey there,
    > I have a question. Is it possible to to construct something through
    > a combination of php and javascript that (when a browser window is
    > closed)[/color]

    No.
    [color=blue]
    > would drop temp tables that are used? I've tried to use an
    > override of the SESSION functions, but that isn't working in the way I
    > would like it to. I go into mysql and can see that the temp tables that
    > were created for the user are still in the database. Also, I would have
    > liked to have used mysql's temp tables, but those tables don't seem to
    > be maintained across different pages in one session. When a user goes
    > from one page to another, those temp tables are gone. Any suggestions?
    >[/color]

    Temporary tables are exactly that - temporary. They are designed to be
    used for a short period of time, e.g. within one SQL transaction.

    If you require data for longer periods of time, you should re-think your
    data structure/processing.

    What sort of information are you using your temp tables for?

    --
    Oli

    Comment

    • Colin McKinnon

      #3
      Re: DROP TEMP TABLES

      Oli Filth wrote:
      [color=blue]
      > Jay said the following on 14/10/2005 14:57:[color=green]
      >> Hey there,
      >> I have a question. Is it possible to to construct something through
      >> a combination of php and javascript that (when a browser window is
      >> closed)[/color]
      >
      > No.
      >[color=green]
      >> would drop temp tables that are used? I've tried to use an
      >> override of the SESSION functions, but that isn't working in the way I
      >> would like it to.[/color][/color]

      Stick at it - this is the only way to solve the problem.
      [color=blue][color=green]
      >> from one page to another, those temp tables are gone. Any suggestions?
      >>[/color]
      >
      > Temporary tables are exactly that - temporary. They are designed to be
      > used for a short period of time, e.g. within one SQL transaction.
      >[/color]

      Erm, bad terminology - they last one MySQL *session* i.e. between
      mysql_connect() and mysql_close() (or end of script).

      But as Oli says - are you *really* sure you need a temporary table?

      C.

      Comment

      • Jerry Sievers

        #4
        Re: DROP TEMP TABLES

        "Jay" <patel@cs.utk.e du> writes:
        [color=blue]
        > Hey there,
        > I have a question. Is it possible to to construct something through
        > a combination of php and javascript that (when a browser window is
        > closed) would drop temp tables that are used? I've tried to use an[/color]

        Sure. You need a php script that will take an arg that tells it what
        table to drop.

        Call this script in a JS onClose event. Have the page that loads as a
        result of this close itself instantly with an onClose in the onLoad
        event.

        Security and all the fine details of this left as your exercise.

        And of course, this isn't going to be totally reliable since not
        everyone has JS enabled.

        May I suggest you abandon this silliness and timestamp your temporary
        tables and drop them with an hourly (or whatever) batch process?

        Or what about using a trigger or rule on the insert to the timestamp
        table that tries to drop old tables whenever a new one is created.


        HTH


        --
        -------------------------------------------------------------------------------
        Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
        305 321-1144 (mobile http://www.JerrySievers.com/

        Comment

        • Jerry Sievers

          #5
          Re: DROP TEMP TABLES

          Oli Filth <catch@olifilth .co.uk> writes:
          [color=blue]
          > Temporary tables are exactly that - temporary. They are designed to be
          > used for a short period of time, e.g. within one SQL transaction.[/color]

          Perhaps. This may depend on what DB you're using.

          In Postgres (7.4.1) temp tables have the lifetime of a backend session
          unless dropped explicitly.

          Within transactions, the temp table will exist after the transaction
          if same is commited, but disappear on a rollback. (as we might
          expect).

          HTH

          --
          -------------------------------------------------------------------------------
          Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
          305 321-1144 (mobile http://www.JerrySievers.com/

          Comment

          • steve

            #6
            Re: DROP TEMP TABLES

            "" wrote:[color=blue]
            > Hey there,
            > I have a question. Is it possible to to construct
            > something through
            > a combination of php and javascript that (when a browser
            > window is
            > closed) would drop temp tables that are used? I've tried to
            > use an
            > override of the SESSION functions, but that isn't working in
            > the way I
            > would like it to. I go into mysql and can see that the temp
            > tables that
            > were created for the user are still in the database. Also, I
            > would have
            > liked to have used mysql's temp tables, but those tables don't
            > seem to
            > be maintained across different pages in one session. When a
            > user goes
            > from one page to another, those temp tables are gone. Any
            > suggestions?
            >
            > -Jay
            > (patel at cs dot utk dot edu)[/color]

            Your particular need can also be addressed by caching data, which
            expires after a set period of time. Look into cache lite. Easy to
            use and setup.

            --
            Posted using the http://www.dbforumz.com interface, at author's request
            Articles individually checked for conformance to usenet standards
            Topic URL: http://www.dbforumz.com/DROP-TEMP-TA...ict263550.html
            Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=909026

            Posted Via Usenet.com Premium Usenet Newsgroup Services
            ----------------------------------------------------------
            ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
            ----------------------------------------------------------
            Best Usenet Service Providers 2025 ranked by Newsgroup Access Newsservers, Usenet Search, Features & Free Trial. Add VPN for privacy.

            Comment

            Working...