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

  • SEARCH
  • Home
  • 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 7548227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:38:43+00:00 2026-05-30T09:38:43+00:00

I just changed from Access to mySQL. I have a few tables, called Veranstaltung

  • 0

I just changed from Access to mySQL. I have a few tables, called “Veranstaltung” and “Veranstaltung_User”. I want to get all events (=Veranstaltung) to which users have subsribed, exept the one, the user is viewing.

I did this with the following statment

SELECT VID, Bezeichnung, Datum 
FROM tbl_Veranstaltung 
WHERE year(Datum) = 2012 
    AND VID <> 613 
    AND VID IN (SELECT BewerbID 
                FROM Veranstaltung_User 
                WHERE UserID IN (SELECT UserID 
                                FROM Veranstaltung_User 
                                WHERE BewerbID = 613) 
                    AND UserID <> 0) 
ORDER BY Datum

In Access, this query was quite fast – in mySQL it needs 44,56 seconds – too much 😉

how can I optimize my statement for faster quering? (mySQL > 5, tables ware MyISAM)

thanks for help

  • 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-05-30T09:38:44+00:00Added an answer on May 30, 2026 at 9:38 am

    Two changes:
    1. Uses JOINs instead of nested IN clauses
    2. Uses <= and > instead of the YEAR() function

    The advantage of change 1 is that sometime IN performance can be worse than expected, and nesting them will exascerabate that.

    The advantage of change 2 is that it allows an index seek to find a range of records. Where-as using YEAR() forcfes a scan of the entire table/index.

    Both of which assume you have appropriate indexes.

    SELECT
      V.VID, V.Bezeichnung, V.Datum
    FROM
      tbl_Veranstaltung     V
    INNER JOIN
      Veranstaltung_User    VUser
        ON VUser.BewerbID = V.VID
    INNER JOIN
      Veranstaltung_User    VUser2
        VUser.UserID = VUser2.UserID
    WHERE
          V.Datum >= '20120101'
      AND V.Datum <  '20130101'
      AND V.VID <> 613
      AND VUser.UserID <> 0
      AND VUser2.BewerbID  = 613
    ORDER BY
      Datum
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I just changed the PageControl project from Apple's site here . The issue
I want to workaround the Webpage has expired issue. First, I just changed a
I have just installed a new ssl certificate on GlassFish 3. I also changed
I don't have a good knowledge of SSL principles, but just want the encryption
I have a program in access that is using some linked ODBC tables. I
I have a MySQL dsetup called in-out and I have written a vb.NET client
I don't know what's wrong, I just changed /etc/httpd/conf/httpd.conf and now I can't access
I've got a mission-critical Access 2003 database that changed from a local MDB, to
hey guys i want to fetch 3 tables in 1 single ado.net call from
I need store just 10 arrays in my app, which I can change from

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.