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 3285784
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:18:20+00:00 2026-05-17T20:18:20+00:00

Im new to Postgres and I dont know how to translate this MySQL query

  • 0

Im new to Postgres and I dont know how to translate this MySQL query to postgres:

SELECT pictures.id, MATCH (title, cached_tag_list) AGAINST ('phrase') AS score FROM pictures WHERE MATCH (title, cached_tag_list) AGAINST ('phrase') ORDER BY score DESC;
  • 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-17T20:18:21+00:00Added an answer on May 17, 2026 at 8:18 pm

    The Postgres fulltext search is a little different from the MySQL fulltext search. It has a lot more options but can be a bit more difficult to get working the way you like it.

    This document tells you how to rank your search results, but I strongly recommend you read the entire fulltext section from the manual to get an idea about what you can do with it: http://www.postgresql.org/docs/current/interactive/textsearch-controls.html#TEXTSEARCH-RANKING

    Basically, the equivalent of your query would be this:

    SELECT pictures.id, ts_rank_cd(textsearch, 'phrase') AS score
    FROM pictures
    ORDER BY score DESC
    

    As you can see, this uses textsearch which is something you will have to define yourself. For the short version, read: http://www.postgresql.org/docs/current/interactive/textsearch-tables.html

    The query is essentially very simple:

    SELECT pictures.id, ts_rank_cd(to_tsvector('english', pictures.title), 'phrase') AS score
    FROM pictures
    ORDER BY score DESC
    

    But I would strongly recommend adding indexes aswell:

    CREATE INDEX pictures_title ON pictures USING gin(to_tsvector('english', title));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to the Oracle Platform (having primarily used MySQL, with a little Postgres
I'm new to conditional statements within postgres. I have the following statement SELECT IF
I am very new to postgres. I got this error when try to run
I have a migration that runs an SQL script to create a new Postgres
For a new project I'm trying to run postgres locally. Mac Lion has Postgres
New to this, so bear with me if I missed this somewhere in another
I'm using Postgres and would like to make a big update query that would
I'm very new to Ruby and postgres. Below is my database.yml development: adapter: postgresql
I have a php script to insert new parts into a postgres database. I
I'm a little new to Postgres. I want to take a value (which is

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.